MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / loadUnread

Function loadUnread

apps/kimi-web/src/lib/storage.ts:103–117  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

101 * survive a page refresh — there is no server-side read cursor.
102 */
103export 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.

Callers 3

saveUnreadFunction · 0.85

Calls 1

safeGetStringFunction · 0.85

Tested by

no test coverage detected