hyperion
hyperion copied to clipboard
Updates to VisibilityPublisher to handle Surfaces with delayed rendering of child elements
The issue we are trying to solve is if a Surface is initially rendered but it's immediate children are delayed or marked with placeholders, we may miss initial attachment/finding/observing of viable child elements for detecting visibility changes. This PR:
- Attaches a mutation observer on mount (behind a flag) if no viable children are found, it looks for additions to immediate child elements and sets up tracking once available
- Optionally (another flag) also detects removal of child nodes and updates tracking, this is to more accurately track other (probably less common) cases where child elements we are tracking could be dynamically removed.
Added example in test app that can demonstrate the issue, and also demonstrate the fix.