fix(web): convert favicon.ico to RGBA format for Turbopack (#544)
All checks were successful
ci/woodpecker/push/web Pipeline was successful
All checks were successful
ci/woodpecker/push/web Pipeline was successful
Co-authored-by: Jason Woltje <jason@diversecanvas.com> Co-committed-by: Jason Woltje <jason@diversecanvas.com>
This commit was merged in pull request #544.
This commit is contained in:
@@ -24,6 +24,43 @@ const SESSION_EXPIRY_WARNING_MINUTES = 5;
|
||||
|
||||
/** Interval in milliseconds to check session expiry */
|
||||
const SESSION_CHECK_INTERVAL_MS = 60_000;
|
||||
|
||||
/**
|
||||
* localStorage key for the active workspace ID.
|
||||
* Must match the WORKSPACE_KEY constant in useLayout.ts and the key read
|
||||
* by apiRequest in client.ts.
|
||||
*/
|
||||
const WORKSPACE_STORAGE_KEY = "mosaic-workspace-id";
|
||||
|
||||
/**
|
||||
* Persist the workspace ID to localStorage so it is available to
|
||||
* useWorkspaceId and apiRequest on the next render / request cycle.
|
||||
* Silently ignores localStorage errors (private browsing, storage full).
|
||||
*/
|
||||
function persistWorkspaceId(workspaceId: string | undefined): void {
|
||||
if (typeof window === "undefined") return;
|
||||
try {
|
||||
if (workspaceId) {
|
||||
localStorage.setItem(WORKSPACE_STORAGE_KEY, workspaceId);
|
||||
}
|
||||
} catch {
|
||||
// localStorage unavailable — not fatal
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the workspace ID from localStorage on sign-out so stale workspace
|
||||
* context is not sent on subsequent unauthenticated requests.
|
||||
*/
|
||||
function clearWorkspaceId(): void {
|
||||
if (typeof window === "undefined") return;
|
||||
try {
|
||||
localStorage.removeItem(WORKSPACE_STORAGE_KEY);
|
||||
} catch {
|
||||
// localStorage unavailable — not fatal
|
||||
}
|
||||
}
|
||||
|
||||
const MOCK_AUTH_USER: AuthUser = {
|
||||
id: "dev-user-local",
|
||||
email: "dev@localhost",
|
||||
@@ -97,6 +134,11 @@ function RealAuthProvider({ children }: { children: ReactNode }): React.JSX.Elem
|
||||
setUser(session.user);
|
||||
setAuthError(null);
|
||||
|
||||
// Persist workspace ID to localStorage so useWorkspaceId and apiRequest
|
||||
// can pick it up without re-fetching the session.
|
||||
// Prefer currentWorkspaceId (the user's active workspace) over workspaceId.
|
||||
persistWorkspaceId(session.user.currentWorkspaceId ?? session.user.workspaceId);
|
||||
|
||||
// Track session expiry timestamp
|
||||
expiresAtRef.current = new Date(session.session.expiresAt);
|
||||
|
||||
@@ -128,6 +170,9 @@ function RealAuthProvider({ children }: { children: ReactNode }): React.JSX.Elem
|
||||
setUser(null);
|
||||
expiresAtRef.current = null;
|
||||
setSessionExpiring(false);
|
||||
// Clear persisted workspace ID so stale context is not sent on
|
||||
// subsequent unauthenticated API requests.
|
||||
clearWorkspaceId();
|
||||
}
|
||||
}, []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user