MCPcopy
hub / github.com/dubinc/dub / setValue

Function setValue

apps/web/lib/hooks/use-synced-local-storage.ts:28–38  ·  view source on GitHub ↗
(newValue: T | ((val: T) => T))

Source from the content-addressed store, hash-verified

26
27 // Wrap the original setValue to emit events
28 const setValue = (newValue: T | ((val: T) => T)) => {
29 if (typeof newValue === "function") {
30 const updater = newValue as (val: T) => T;
31 const nextValue = updater(value);
32 setValueOriginal(nextValue);
33 storageEventChannel.emit(key, JSON.stringify(nextValue));
34 } else {
35 setValueOriginal(newValue);
36 storageEventChannel.emit(key, JSON.stringify(newValue));
37 }
38 };
39
40 useEffect(() => {
41 // Listen for both storage events (cross-window) and custom events (same-window)

Callers 15

handleUploadFunction · 0.50
FormFunction · 0.50
page-client.tsxFile · 0.50
updateRequirementsFunction · 0.50
handleStartDateToggleFunction · 0.50
handleEndDateToggleFunction · 0.50
handleEndDateChangeFunction · 0.50
useAddEditBountyFormFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…