mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
A timer-tick flushAudioBatch() whose native IPC is still awaiting could be left un-awaited by stopRecording()/cleanup(), which only awaited the flush they kicked off themselves. Stopping in that window let stop_dictation fire before an earlier flush's chunks were enqueued native-side, dropping late chunks and losing transcript words. Serialize flushes through a flushChainRef promise tail: each flush drains the batch synchronously (distinct FIFO payload) then chains its IPC send after any prior in-flight flush. stopRecording()/cleanup() await the chain tail (the empty-batch path now returns the tail), guaranteeing every started flush is fully enqueued before stop. Chain is reset per session in startRecording. Bump MessageComposer.tsx file-size override (+15) for the dictation wiring that pushed it 1033->1049, matching the existing load-bearing-growth pattern.