Merge pull request #4324 from Budibase/fix/reset-builder-store-on-app-change

Reset the builder store whenever unmounting the app root layout
This commit is contained in:
Andrew Kingston 2022-02-04 10:26:09 +00:00 committed by GitHub
commit 3b241a8ab0
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}