Skip to content

[6.x] Fix Bard debounce race condition, Set move error, and Firefox scroll jumps#13849

Open
o1y wants to merge 3 commits intostatamic:6.xfrom
o1y:fix-13772
Open

[6.x] Fix Bard debounce race condition, Set move error, and Firefox scroll jumps#13849
o1y wants to merge 3 commits intostatamic:6.xfrom
o1y:fix-13772

Conversation

@o1y
Copy link
Contributor

@o1y o1y commented Feb 8, 2026

Fixes #13698
Fixes #13772

This addresses a few Bard issues:

  1. Re-enable debouncing and fix race condition
    As a workaround PR [6.x] Disable Bard debouncing #13797 previously disabled debouncing. The debouncing issues were caused by the user editing content faster than the 150ms debounce delay (e.g. when deleting content and pasting new content). This adds a cancel() method to the debounce utility to cancel pending debounced updates before immediate updates, preventing stale content from overwriting fresh changes.

  2. Fix type error when moving Sets
    Moving Sets caused the error: Uncaught (in promise) TypeError: can't access property "getJSON", this.editor is null.

  3. Fix scroll jumps in Firefox Browsers
    The stylesheet changes introduced in [6.x] Nested bard fixed toolbars - remove sticky stacking approach #13750 caused Firefox to scroll to the top of the parent Bard field when clicking into nested Bard fields.

o1y added 3 commits February 7, 2026 12:04
This adds cancel() method to debounce utility to cancel pending debounced updates before immediate updates to prevent stale content from overwriting fresh changes. This could for instance happen if the user pastes content after deleting content in less than 150ms.
When moving Sets with Bard fields, the value watcher could fire while the editor is null.
@duncanmcclean
Copy link
Member

Woah, nice work! 🧙

Comment on lines +17 to +23

debounced.cancel = function () {
clearTimeout(timeout);
timeout = null;
};

return debounced;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's blowing my mind a bit that debounced can be a function but can also have properties? wha?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, there are also some build in ones like debounced.name, debounced.length .. functions are objects :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants