Reset the builder store whenever unmounting the app root layout

This commit is contained in:
Andrew Kingston 2022-02-04 09:29:51 +00:00
parent 47dc1ac540
commit 2c0af72cd4
2 changed files with 8 additions and 1 deletions

View File

@ -65,6 +65,9 @@ export const getFrontendStore = () => {
const store = writable({ ...INITIAL_FRONTEND_STATE })
store.actions = {
reset: () => {
store.set({ ...INITIAL_FRONTEND_STATE })
},
initialise: async pkg => {
const { layouts, screens, application, clientLibPath } = pkg
const components = await fetchComponentLibDefinitions(application.appId)

View File

@ -12,7 +12,7 @@
import Logo from "assets/bb-emblem.svg"
import { capitalise } from "helpers"
import UpgradeModal from "../../../../components/upgrade/UpgradeModal.svelte"
import { onMount } from "svelte"
import { onMount, onDestroy } from "svelte"
// Get Package and set store
export let application
@ -81,6 +81,10 @@
hasSynced = true
}
})
onDestroy(() => {
store.actions.reset()
})
</script>
{#await promise}