fix(domtools): Prevent race conditions during DomTools initialization and improve runOnce error handling

This commit is contained in:
2025-11-16 15:29:23 +00:00
parent d16bc1652d
commit 039ee19ffd
4 changed files with 508 additions and 90 deletions

View File

@@ -1,5 +1,13 @@
# Changelog
## 2025-11-16 - 2.3.4 - fix(domtools)
Prevent race conditions during DomTools initialization and improve runOnce error handling
- Add a static initializationPromise to serialize and await concurrent DomTools.setupDomTools() calls to avoid race conditions when multiple initializations are requested.
- Initialize Keyboard only after the document is ready (check document.readyState and use readystatechange listener) so document.body/head are available before creating the Keyboard instance; resolve domReady and domToolsReady appropriately.
- Support ignoreGlobal path to create isolated DomTools instances while keeping global initialization guarded by initializationPromise.
- Enhance runOnce: store errors from the first execution and re-throw them to all waiting callers; always clear the running flag in a finally block to prevent permanent stuck state.
## 2025-06-20 - 2.3.3 - fix(package.json)
Update dependency versions and add pnpm package manager field