Review 12.4 Merged

82169[BUGFIX] Fix link-element initialization race condition

Benjamin Franzke CR +2 V +2 Normal +70 −43 updated 12/11/23, 16:27

Commit message

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.

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
  • Verified V +2 Done
    • Benjamin Franzke +2
    • core-ci +1 CI

Issues 2

Files 5

Review log 23

  1. Benjamin Franzke uploaded patch set 1 12/11/23, 16:10

  2. core-ci voted on patch set 1 V +1 12/11/23, 16:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50565

  3. Benjamin Franzke merged patch set 2 12/11/23, 16:27