Skip to content
Snippets Groups Projects
Commit 7866d44f authored by Benjamin Franzke's avatar Benjamin Franzke Committed by Oliver Bartsch
Browse files

[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: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarOliver Bartsch <bo@cedev.de>
Tested-by: default avatarcore-ci <typo3@b13.com>
Reviewed-by: default avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarAndreas Kienast <a.fernandez@scripting-base.de>
parent e2ecd89e
Branches
Tags
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment