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

Function resolveRootRedirect

frontend/src/react/router/guard.ts:100–114  ·  view source on GitHub ↗
(
  store: ReturnType<typeof useAppStore.getState>
)

Source from the content-addressed store, hash-verified

98// `loadWorkspaceProfile()` is awaited before the router mounts (see main.ts),
99// so `appFeatures` is populated by the time this runs.
100function resolveRootRedirect(
101 store: ReturnType<typeof useAppStore.getState>
102): string {
103 if (
104 store.appFeatures["bb.feature.database-change-mode"] ===
105 DatabaseChangeMode.EDITOR
106 ) {
107 return resolvePath(SQL_EDITOR_HOME_MODULE);
108 }
109 const lastVisit = readLastVisit(store);
110 if (lastVisit && isMeaningfulVisit(lastVisit)) {
111 return lastVisit;
112 }
113 return resolvePath(WORKSPACE_ROUTE_LANDING);
114}
115
116// Read the most-recent visited path from the per-user recent-visit list in
117// localStorage (same scoped key + JSON format as `useRecentVisit`).

Callers 1

rootGuardFunction · 0.85

Calls 3

resolvePathFunction · 0.90
readLastVisitFunction · 0.85
isMeaningfulVisitFunction · 0.85

Tested by

no test coverage detected