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

Function setValueAndPersist

packages/shared/src/hooks/usePersistentState.ts:13–19  ·  view source on GitHub ↗
(newValue: T)

Source from the content-addressed store, hash-verified

11 const [loaded, setLoaded] = useState(false);
12
13 const setValueAndPersist = (newValue: T): Promise<void> => {
14 if (newValue !== value) {
15 setValue(newValue);
16 return setCache(key, newValue);
17 }
18 return Promise.resolve();
19 };
20
21 useEffect(() => {
22 getCache<T>(key)

Callers 1

usePersistentStateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected