diff --git a/apps/appstore/src/store/apps.ts b/apps/appstore/src/store/apps.ts index 11fac2ba464c9..0540a68fa5ecb 100644 --- a/apps/appstore/src/store/apps.ts +++ b/apps/appstore/src/store/apps.ts @@ -231,6 +231,38 @@ export const useAppsStore = defineStore('apps', () => { } } + // initialize store + initialize() + + return { + apps, + bundles, + categories, + isLoadingApps, + isLoadingCategories, + + disableApp, + enableApp, + uninstallApp, + enableBundle, + + getAppById, + getAppsByCategory, + getCategoryById, + limitAppToGroups, + } + + /** + * Initialize the store + */ + async function initialize() { + await Promise.allSettled([ + loadApps(), + loadCategories(), + exApps.isEnabled ? exApps.initialize() : Promise.resolve(), + ]) + } + /** * Load the app categories from the backend */ @@ -260,26 +292,4 @@ export const useAppsStore = defineStore('apps', () => { isLoadingApps.value = false } } - - // initialize store - loadApps() - loadCategories() - - return { - apps, - bundles, - categories, - isLoadingApps, - isLoadingCategories, - - disableApp, - enableApp, - uninstallApp, - enableBundle, - - getAppById, - getAppsByCategory, - getCategoryById, - limitAppToGroups, - } })