Skip to content

🌳 Plant another (metadata) tree#365

Merged
hayleigh-dot-dev merged 12 commits intomainfrom
metadata-tree
Aug 7, 2025
Merged

🌳 Plant another (metadata) tree#365
hayleigh-dot-dev merged 12 commits intomainfrom
metadata-tree

Conversation

@yoshi-monster
Copy link
Contributor

@yoshi-monster yoshi-monster commented Aug 7, 2025

Keeps parent and children references inside the metadata that we attach to each node. These references are updated in sync with the real DOM tree, and are used to navigate the DOM while traversing the patches.

Compared to the normal DOM tree, this metadata tree contains fragments; All the special casing for fragments (compared to elements) is now no longer necessary and got removed. Instead, the reconciler can traverse fragments like normal elements by using the new tree.

This should fix most fragment bugs, and make Lustre more resilient against other scripts or the browser mucking with the DOM; The offset that we keep for stylesheets for example is no longer required, and in general other scripts can insert and move Lustres elements around freely. In the future, we could detect some cases (for example translators) and handle those more intelligently. It also should fix all the event-related problems with fragments, since now our original assumption is actually always true.

fixes #355.

@hayleigh-dot-dev hayleigh-dot-dev merged commit 5b76d4a into main Aug 7, 2025
1 check passed
@hayleigh-dot-dev
Copy link
Collaborator

Incredible stuff yoshi 💕

@yoshi-monster yoshi-monster deleted the metadata-tree branch August 8, 2025 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nested fragment cause the path to be wrongly computed

2 participants