diff --git a/ui/web/src/lib/setup-skip.ts b/ui/web/src/lib/setup-skip.ts index 4e465446..5bbcb272 100644 --- a/ui/web/src/lib/setup-skip.ts +++ b/ui/web/src/lib/setup-skip.ts @@ -14,27 +14,16 @@ function getScopePart(value: string | null | undefined, fallback: string) { } function getScopedSetupSkipKey(scope: SetupSkipScope) { - const tenantScope = getScopePart( - scope.tenantId ?? scope.tenantSlug ?? localStorage.getItem(LOCAL_STORAGE_KEYS.TENANT_ID), - "default", - ); - const userScope = getScopePart( - scope.userId ?? localStorage.getItem(LOCAL_STORAGE_KEYS.USER_ID), - "anonymous", - ); - - return `${SETUP_SKIPPED_PREFIX}${encodeURIComponent(tenantScope)}:${encodeURIComponent(userScope)}`; + const tenantScope = getScopePart(scope.tenantId ?? scope.tenantSlug, "default"); + const userScope = getScopePart(scope.userId, "anonymous"); + return `${SETUP_SKIPPED_PREFIX}${tenantScope}:${userScope}`; } export function isSetupSkipped(scope: SetupSkipScope) { - if (localStorage.getItem(LOCAL_STORAGE_KEYS.SETUP_SKIPPED) !== null) { - localStorage.removeItem(LOCAL_STORAGE_KEYS.SETUP_SKIPPED); - } return localStorage.getItem(getScopedSetupSkipKey(scope)) === "1"; } export function markSetupSkipped(scope: SetupSkipScope) { - localStorage.removeItem(LOCAL_STORAGE_KEYS.SETUP_SKIPPED); localStorage.setItem(getScopedSetupSkipKey(scope), "1"); } @@ -43,7 +32,7 @@ export function clearSetupSkippedState() { for (let i = 0; i < localStorage.length; i += 1) { const key = localStorage.key(i); if (!key) continue; - if (key === LOCAL_STORAGE_KEYS.SETUP_SKIPPED || key.startsWith(SETUP_SKIPPED_PREFIX)) { + if (key.startsWith(SETUP_SKIPPED_PREFIX)) { keysToRemove.push(key); } }