1
0
Fork 0
mirror of synced 2024-07-30 02:26:11 +12:00

Run all builder data hydration API calls in parallel to speed up builder loading

This commit is contained in:
Andrew Kingston 2024-02-05 11:15:48 +00:00
parent 233df4c27c
commit 090460a8f5

View file

@ -82,13 +82,15 @@ export const reset = () => {
} }
const refreshBuilderData = async () => { const refreshBuilderData = async () => {
await automationStore.actions.fetch() await Promise.all([
await datasources.init() automationStore.actions.fetch(),
await integrations.init() datasources.init(),
await queries.init() integrations.init(),
await tables.init() queries.init(),
await roles.fetch() tables.init(),
await flags.fetch() roles.fetch(),
flags.fetch(),
])
} }
const resetBuilderHistory = () => { const resetBuilderHistory = () => {
@ -98,27 +100,16 @@ const resetBuilderHistory = () => {
export const initialise = async pkg => { export const initialise = async pkg => {
const { application } = pkg const { application } = pkg
appStore.syncAppPackage(pkg) appStore.syncAppPackage(pkg)
appStore.syncAppRoutes() appStore.syncAppRoutes()
builderStore.init(application) builderStore.init(application)
navigationStore.syncAppNavigation(application?.navigation) navigationStore.syncAppNavigation(application?.navigation)
await componentStore.refreshDefinitions(application?.appId) await componentStore.refreshDefinitions(application?.appId)
themeStore.syncAppTheme(application) themeStore.syncAppTheme(application)
screenStore.syncAppScreens(pkg) screenStore.syncAppScreens(pkg)
layoutStore.syncAppLayouts(pkg) layoutStore.syncAppLayouts(pkg)
// required for api comms // required for api comms
database.syncAppDatabase(application) database.syncAppDatabase(application)
resetBuilderHistory() resetBuilderHistory()
await refreshBuilderData() await refreshBuilderData()
} }