()
| 101 | * survive a page refresh — there is no server-side read cursor. |
| 102 | */ |
| 103 | export function loadUnread(): Record<string, boolean> { |
| 104 | const raw = safeGetString(STORAGE_KEYS.unread); |
| 105 | if (!raw) return {}; |
| 106 | try { |
| 107 | const parsed = JSON.parse(raw) as unknown; |
| 108 | if (!parsed || typeof parsed !== 'object') return {}; |
| 109 | const out: Record<string, boolean> = {}; |
| 110 | for (const [id, value] of Object.entries(parsed as Record<string, unknown>)) { |
| 111 | if (value === true) out[id] = true; |
| 112 | } |
| 113 | return out; |
| 114 | } catch { |
| 115 | return {}; |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * Apply a partial set of unread changes on top of the latest stored value. |
no test coverage detected