Ensure builder websocket is only instantiated once

This commit is contained in:
Andrew Kingston 2023-06-26 08:58:06 +01:00
parent fd8400bee5
commit 5d14bb70c6
1 changed files with 4 additions and 1 deletions

View File

@ -117,10 +117,13 @@ export const getFrontendStore = () => {
reset: () => {
store.set({ ...INITIAL_FRONTEND_STATE })
websocket?.disconnect()
websocket = null
},
initialise: async pkg => {
const { layouts, screens, application, clientLibPath, hasLock } = pkg
websocket = createBuilderWebsocket(application.appId)
if (!websocket) {
websocket = createBuilderWebsocket(application.appId)
}
await store.actions.components.refreshDefinitions(application.appId)
// Reset store state