Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Fix link-element initialization race condition
Children of custom elements 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 all child elements will already be available. See #102550 for details. To circumvent this race we make use of HTML event bubbling. That means we register our event handlers on the wrapper element and will receive events that are triggered on one of the children elements. To circumvent the initialization race conditions in connectedCallback() we shift the stateful initialization to the server-side rendering. Note that we either need to render html components server or client-side in order to avoid such race conditions or nasty workarounds (like adding mutation observs and keeping track whether all elements have already been added or not). Ideally the link-element component would be rendered fully client-side at some point, but that's out of scope for now. Resolves: #102603 Related: #102550 Releases: main, 12.4 Change-Id: I54715fd671f717e4253ee41e8ac33a1ca5960eae Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82169 Reviewed-by: Benjamin Franzke <ben@bnf.dev> Tested-by: core-ci <typo3@b13.com> Tested-by: Benjamin Franzke <ben@bnf.dev>
- Loading branch information
Showing
5 changed files
with
70 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/link-element.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.