ampproject / ampproject/worker-dom

Experiment with Transferring Node Position instead of Node Index

Open
#18 0 comments 1 reaction 1 assignee Claimed by @kristoferbaxter View on GitHub
hydration mutation
Dominant language
TypeScript
Stars
3.3k
Forks
154
PR merge metrics
No merged PRs in 30d

Description

Right now the library maintains a Map on both sides of the bridge, additionally Elements are given a property _index_ that corresponds to their number in the mapping. This allows both sides to easily reference Elements as they are created or modified.

However this creates a hard reference to the Element and means that these objects cannot be fully removed by GC.

If we move away from a mapping, and instead leverage the Elements position in the tree as its identifier, we are no longer holding a direct reference. This could mean GC is able to more easily remove these Element objects when they are no longer necessary.

However, this likely introduces other problems to solve like race conditions between the placement of nodes during events. We'll be exploring this option since it's the easiest to test.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.