MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / flush

Function flush

cli/src/utils/message-updater.ts:134–149  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

132 let isDisposed = false
133
134 const flush = () => {
135 if (pendingUpdaters.length === 0) return
136
137 // Capture and clear the queue atomically
138 const updaters = pendingUpdaters.splice(0, pendingUpdaters.length)
139
140 // Compose all pending updaters into a single transform
141 const composedUpdater = (msg: ChatMessage): ChatMessage => {
142 return updaters.reduce((m, fn) => fn(m), msg)
143 }
144
145 // Apply composed update to the target message
146 setMessages((prev) =>
147 prev.map((msg) => (msg.id === aiMessageId ? composedUpdater(msg) : msg)),
148 )
149 }
150
151 const dispose = () => {
152 if (isDisposed) return

Callers 3

disposeFunction · 0.70
markCompleteFunction · 0.70
setErrorFunction · 0.70

Calls 1

composedUpdaterFunction · 0.85

Tested by

no test coverage detected