[BUGFIX] Fix value-picker initialization race condition
(Custom) element children are not guaranteed to be available by the time the element is added to the DOM — i.e. when the connectedCallback() is triggered by the browser. That means we can not assume that value-picker <select> children will always be available. Note that it worked most of the times, because JavaScript modules are loaded asynchronously, and thus "most of the times" execute later after the DOM is rendered, but when the server is really busy, the HTML output can be rendered very late, so that a connectedCallback is triggered immediately when an opening tag is written to the DOM — even before the childrens are attached. (Otherwise the browsers would have to delay the connectedCallback's until the closing tag is rendered, but that's not the case — at least not in google chrome.) To circumvent this we use a slotchange listener (which is basically a mutation observer) to assure we are notified about async child updates. Resolves: #102550 Related: #102330 Releases: main, 12.4 Change-Id: I73179335c390f08f42f3426dcffec338f6355d61 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81993 Tested-by:Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Oliver Bartsch <bo@cedev.de> Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Oliver Bartsch <bo@cedev.de> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Andreas Kienast <a.fernandez@scripting-base.de>
Showing
- Build/Sources/TypeScript/backend/form-engine/field-wizard/value-picker.ts 43 additions, 18 deletions...peScript/backend/form-engine/field-wizard/value-picker.ts
- typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-wizard/value-picker.js 1 addition, 1 deletion...ublic/JavaScript/form-engine/field-wizard/value-picker.js
Please register or sign in to comment