()
| 60 | // at call time; if it isn't hydrated yet the scope falls back to "" and the |
| 61 | // project is re-resolved from the route anyway. |
| 62 | const lastProjectKey = () => { |
| 63 | const state = useAppStore.getState(); |
| 64 | // Defensive: this runs at module-init (store may be pre-hydration) and the |
| 65 | // app store is mocked in some tests, so isSaaSMode may be absent. Default to |
| 66 | // the unscoped (self-host) key in that case. |
| 67 | const isSaaS = |
| 68 | typeof state?.isSaaSMode === "function" ? state.isSaaSMode() : false; |
| 69 | return storageKeySqlEditorLastProject( |
| 70 | workspaceCacheScope(isSaaS, state?.currentUser?.workspace ?? "") |
| 71 | ); |
| 72 | }; |
| 73 | |
| 74 | const readProject = () => |
| 75 | safeRead<string>( |
no test coverage detected