MCPcopy Create free account
hub / github.com/bytebase/bytebase / load

Function load

frontend/src/react/components/ProjectRouteShell.tsx:64–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62 onReadyRef.current?.(null);
63
64 const load = async () => {
65 await Promise.all([loadCurrentUser(), loadServerInfo()]);
66 const nextProject = await fetchProject(projectName);
67 if (stale) return;
68 if (!nextProject) {
69 const projectRoute = navigateRef.current.resolve({
70 name: PROJECT_V1_ROUTE_DETAIL,
71 params: { projectId },
72 });
73 removeRecentVisit(projectRoute.fullPath);
74 const error = useAppStore.getState().projectErrorsByName[projectName];
75 if (error) {
76 notify({
77 module: "bytebase",
78 style: "CRITICAL",
79 title: `Failed to fetch project ${projectId}`,
80 description: error.message,
81 });
82 }
83 void navigateRef.current.replace({ name: WORKSPACE_ROUTE_LANDING });
84 return;
85 }
86 setRecentProject(nextProject.name);
87 await loadProjectIamPolicy(nextProject.name);
88 if (!stale) {
89 setReadyProjectName(projectName);
90 }
91 };
92
93 void load();
94 return () => {

Callers 1

ProjectRouteShellFunction · 0.70

Calls 2

notifyFunction · 0.85
resolveMethod · 0.80

Tested by

no test coverage detected