01 · Before and afterThe pattern
// before: act on the debounced mirror and the target captured at click time
const text = store.getState().draftText; // debounced copy, lags the editor
await upload(file); composer.append(text + markup);
// after: read live, capture target, verify after the await
const target = activeTargetId();
await upload(file);
if (target !== activeTargetId()) return fail("target changed");
composer.append(editor.getMarkdown() + markup);02 · Run it on your appThe check
Do any buttons in your app act on state that is updated through a debounce or throttle?
If the honest answer is no or not sure, this is worth a look before it reaches production.