Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider create and destroy operations to avoid re-serializing nodes on insert #430

Open
lemonmade opened this issue Aug 30, 2024 · 0 comments

Comments

@lemonmade
Copy link
Member

Through considering Shopify’s use of Remote DOM, @jakearchibald proposed that we introduce create and destroy operations; create could be called the first time a new element is being attached to the tree, and destroy could be called in a FinalizationRegistry callback, once the element is no longer used by the partner.

I was initially resistant to this because a) this does not fall out naturally from the MutationObserver subclass for environments with a real DOM, and b) because it required the host to do more work, since each individual attribute/ property set on elements will arrive as a separate message in this model. However, I think this may be the better tradeoff, since situations like reordering a table view (Jake’s main example) could require a huge amount of excess information being sent over the bridge, with each table row potentially needing both a remove and insert operation.

Original proposal (includes some code showing an approach to doing this with MutationObserver) (Shopify-only)

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

No branches or pull requests

1 participant