Review main Merged

81993[BUGFIX] Fix value-picker initialization race condition

Benjamin Franzke CR +2 V +2 Normal +45 −20 updated 12/01/23, 07:44

Commit message

(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.

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Christian Kuhn +1
    • Andreas Kienast +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 2

Files 2

Review log 812

  1. Benjamin Franzke uploaded patch set 1 11/28/23, 13:18

  2. core-ci voted on patch set 1 V +1 11/28/23, 13:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50052

  3. Benjamin Franzke uploaded patch set 2 V +1 11/28/23, 13:37

  4. core-ci voted on patch set 2 V +1 11/28/23, 13:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50053

  5. Benjamin Franzke uploaded patch set 3 V +1 11/29/23, 08:20

  6. core-ci voted on patch set 3 V -1 11/29/23, 08:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50091

  7. core-ci voted on patch set 3 V +1 11/29/23, 08:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50091

  8. Christian Kuhn voted on patch set 3 CR +1 V +1 11/29/23, 18:15

  9. Andreas Kienast voted on patch set 3 CR +1 11/30/23, 10:02

  10. Oli Bartsch voted on patch set 3 CR +2 V +2 12/01/23, 07:17

  11. Oli Bartsch merged patch set 4 12/01/23, 07:33

  12. Benjamin Franzke commented on patch set 4 12/01/23, 07:44

    Sorry, I actually wanted to improve this commit message a bit, but forget about it, so I'm leaving it here as post-merge note: Tiny correction on this statement that turned out to be not 100% correct. It's not really the server that is busy (our html content is not streamed, so the server is/was ready), but basically a parser timing "thingy" that were caused on development/ci machines when xdebug (thing of parallel requests) and browser dom parsing were running in parallel. The behaviour we're working around here is a known wont-fix issue/decision that connectedCallback is basically defined to run early: See https://github.com/WICG/webcomponents/issues/551 was marked as wont-fix in chromium/blink: https://bugs.chromium.org/p/chromium/issues/detail?id=639847