MCPcopy Create free account
hub / github.com/dailydotdev/apps / writeStoredFlags

Function writeStoredFlags

packages/shared/src/contexts/SettingsContext.tsx:272–279  ·  view source on GitHub ↗
(
  userId: string | undefined,
  flags: ClientOnlySettingsFlags,
)

Source from the content-addressed store, hash-verified

270// replace drops whichever ones its `flags` had not loaded yet. It also loses a
271// second tab's write landing between this read and the set.
272const writeStoredFlags = (
273 userId: string | undefined,
274 flags: ClientOnlySettingsFlags,
275): void =>
276 storageWrapper.setItem(
277 clientOnlyFlagsKey(userId),
278 JSON.stringify({ ...readStoredFlags(userId), ...flags }),
279 );
280
281// The one write that has to remove keys: a graduated flag leaves the store for
282// good once the API holds it, which is what stops the migration repeating.

Callers 1

setSettingsFunction · 0.85

Calls 2

clientOnlyFlagsKeyFunction · 0.85
readStoredFlagsFunction · 0.85

Tested by

no test coverage detected