From 99c167c54fd15cc6240d055006c7328c871dbf79 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 23 Nov 2020 14:28:02 +0000 Subject: [PATCH] Fix reinstantiating app when builder props change --- packages/client/src/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/client/src/index.js b/packages/client/src/index.js index cb00d4b708..e925c3e273 100644 --- a/packages/client/src/index.js +++ b/packages/client/src/index.js @@ -1,9 +1,14 @@ import ClientApp from "./components/ClientApp.svelte" -// Initialise client app +let app + const loadBudibase = () => { - window.document.body.innerHTML = "" - new ClientApp({ + // Destroy old app if one exists + if (app) { + app.$destroy() + } + // Create new app + app = new ClientApp({ target: window.document.body, }) }