()
| 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 () => { |
no test coverage detected