From 090460a8f5972838facac2b8f7284b01ff07ccf1 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 5 Feb 2024 11:15:48 +0000 Subject: [PATCH] Run all builder data hydration API calls in parallel to speed up builder loading --- packages/builder/src/stores/builder/index.js | 27 +++++++------------- 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/packages/builder/src/stores/builder/index.js b/packages/builder/src/stores/builder/index.js index 317e97a0ac..c7e882428e 100644 --- a/packages/builder/src/stores/builder/index.js +++ b/packages/builder/src/stores/builder/index.js @@ -82,13 +82,15 @@ export const reset = () => { } const refreshBuilderData = async () => { - await automationStore.actions.fetch() - await datasources.init() - await integrations.init() - await queries.init() - await tables.init() - await roles.fetch() - await flags.fetch() + await Promise.all([ + automationStore.actions.fetch(), + datasources.init(), + integrations.init(), + queries.init(), + tables.init(), + roles.fetch(), + flags.fetch(), + ]) } const resetBuilderHistory = () => { @@ -98,27 +100,16 @@ const resetBuilderHistory = () => { export const initialise = async pkg => { const { application } = pkg - appStore.syncAppPackage(pkg) - appStore.syncAppRoutes() - builderStore.init(application) - navigationStore.syncAppNavigation(application?.navigation) - await componentStore.refreshDefinitions(application?.appId) - themeStore.syncAppTheme(application) - screenStore.syncAppScreens(pkg) - layoutStore.syncAppLayouts(pkg) - // required for api comms database.syncAppDatabase(application) - resetBuilderHistory() - await refreshBuilderData() }