Skip to content

Fix hit testing on stale derived paint lists after node removal - #699

Open
nicoburns wants to merge 3 commits into
mainfrom
devin/1786625229-fix-stale-hit-test
Open

Fix hit testing on stale derived paint lists after node removal#699
nicoburns wants to merge 3 commits into
mainfrom
devin/1786625229-fix-stale-hit-test

Conversation

@nicoburns

@nicoburns nicoburns commented Aug 13, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #624.

paint_children, stacking-context hoisted children, and inline layout data are derived data rebuilt during resolve(). DocumentMutator::remove_and_drop_node updates parent.children but not these lists, so a hit test between the removal and the next resolve iterated stale NodeIds and panicked in Node::hit_inner via self.with(id) (tree().get(id).unwrap()).

hit_inner now does a fallible lookup and skips ids that are no longer live, in all four places that consume derived ids:

// pos/neg z hoisted children + paint_children:
- self.with(id).hit_inner(...)
+ let Some(child) = self.tree().get(id) else { continue };
+ child.hit_inner(...)

// inline text hits: a stale text node id is no longer returned as a HitResult

Regression tests in tests/blitz-tests/tests/hit_test_after_remove_node.rs cover all four paths (plain child, positive/negative z-index hoisted child, inline text); each panicked before the fix.

Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/30a37a9f486c4e0e8ba8c6cb5197c1fc
Requested by: @nicoburns

WPT results

No changes in test results compared to main.

Generated by the WPT workflow.

paint_children, stacking-context hoisted children, and inline layout data
are derived data rebuilt during resolve(). After remove_and_drop_node
(and before the next resolve) they can contain stale NodeIds, causing
hit_inner to panic on tree().get(id).unwrap().

Fixes #624
@staging-devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@staging-devin-ai-integration staging-devin-ai-integration Bot changed the title Skip stale NodeIds in hit_inner after node removal Fix hit testing on stale derived paint lists after node removal Aug 13, 2026
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.

Stale paint_children / hoisted children cause hit_inner panic after remove_and_drop_node

1 participant