export function collapsedSidebarSectionsStorageKey( userId: string | null | undefined, ): string | null { if (!userId) return null; return `rakazo:collapsed-sidebar-sections:${userId}`; } export function readCollapsedSidebarSections(userId: string | null | undefined): Set { const storageKey = collapsedSidebarSectionsStorageKey(userId); if (!storageKey) return new Set(); try { const value = window.localStorage.getItem(storageKey); const keys: unknown = value ? JSON.parse(value) : []; return new Set( Array.isArray(keys) ? keys.filter((key): key is string => typeof key === "string") : [], ); } catch { return new Set(); } }