Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Group the await to prepare the context in one batch.

天舟39ba01259c5b
diff --git a/frontend/src/components/ProvideContext.vue b/frontend/src/components/ProvideContext.vue
index b8e045324d..b976f04ada 100644
--- a/frontend/src/components/ProvideContext.vue
+++ b/frontend/src/components/ProvideContext.vue
@@ -10,13 +10,16 @@ export default {
async setup() {
const store = useStore();
- await store.dispatch("principal/fetchPrincipalList");
- // This depends on principal/fetchPrincipalList
- await store.dispatch("roleMapping/fetchRoleMappingList");
-
- await store.dispatch("environment/fetchEnvironmentList");
-
- await store.dispatch("uistate/restoreState");
+ // Group the await to prepare the context in one batch.
+ // If we split the await one by one, the execution flow will be interrupted
+ // by router.beforeEach, which will pre-maturely fetches data relying on the
+ // context here.
+ await Promise.all([
+ store.dispatch("environment/fetchEnvironmentList"),
+ store.dispatch("principal/fetchPrincipalList"),
+ store.dispatch("roleMapping/fetchRoleMappingList"),
+ store.dispatch("uistate/restoreState"),
+ ]);
},
};
</script>