Review main Merged

89039[BUGFIX] Check state in web components extending `HTMLElement`

Andreas Kienast CR +2 V +2 Normal +55 −10 updated 04/23/25, 13:06

Commit message

Web components that extend `HTMLElement` directly suffer from poor
lifecycles as `connectedCallback()` is called when the component is
added into the DOM, and when it is moved. This causes several issues,
e.g. double initialization or stacked event listeners.

This is a major issue in FormEngine as IRRE elements may get re-ordered
and thus the position of their children change in the DOM, calling
`connectedCallback()` again.

To solve this issue in FormEngine context for now, internal state is
checked and futher processing is aborted, if suitable.

Review

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

Issues 1

Files 18

Review log 1013

  1. Andreas Kienast uploaded patch set 1 04/10/25, 14:22

  2. core-ci voted on patch set 1 V +1 04/10/25, 14:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77441

  3. Andreas Kienast uploaded patch set 2 V +1 04/11/25, 07:47

  4. core-ci voted on patch set 2 V +1 04/11/25, 07:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77498

  5. Markus Klein voted on patch set 2 CR +1 04/11/25, 08:51

  6. Benjamin Franzke commented on patch set 2 CR -1 04/16/25, 06:40

    category-element.ts:44

    Since we do not render the child elements, I'm not 100% sure we can rely on them being available by the time firstUpdated is invoked. Yes, because lit render cycle is microtask scheduled, but not scheduled to any dom events. I think we should track initialisation state instead and keep with plain HTMLElement`s for these ugly element wrapper components.
  7. Andreas Kienast uploaded patch set 3 CR +1 V +1 04/22/25, 08:47

  8. Andreas Kienast commented on patch set 3 04/22/25, 08:47

    category-element.ts:44 Reply

    Done
  9. core-ci voted on patch set 3 V +1 04/22/25, 08:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78019

  10. Benjamin Franzke voted on patch set 3 CR +1 V +1 04/22/25, 10:59

  11. Christian Kuhn voted on patch set 3 CR +1 V +1 04/23/25, 10:40

  12. Andreas Kienast voted on patch set 3 CR +2 V +2 04/23/25, 10:48

  13. Andreas Kienast merged patch set 4 04/23/25, 13:06