MCPcopy Index your code
hub / github.com/simstudioai/sim / createBatchedUpdater

Function createBatchedUpdater

apps/sim/stores/workflow-diff/utils.ts:176–191  ·  view source on GitHub ↗
(set: (updates: Partial<WorkflowDiffState>) => void)

Source from the content-addressed store, hash-verified

174}
175
176export function createBatchedUpdater(set: (updates: Partial<WorkflowDiffState>) => void) {
177 let updateTimer: NodeJS.Timeout | null = null
178 const UPDATE_DEBOUNCE_MS = 16
179 let pendingUpdates: Partial<WorkflowDiffState> = {}
180 return (updates: Partial<WorkflowDiffState>) => {
181 Object.assign(pendingUpdates, updates)
182 if (updateTimer) {
183 clearTimeout(updateTimer)
184 }
185 updateTimer = setTimeout(() => {
186 set(pendingUpdates)
187 pendingUpdates = {}
188 updateTimer = null
189 }, UPDATE_DEBOUNCE_MS)
190 }
191}

Callers 1

store.tsFile · 0.90

Calls 1

setFunction · 0.50

Tested by

no test coverage detected