Skip to content

fix(recyclerview): prevent orphaned pending child layouts#2378

Open
wanxiankai wants to merge 1 commit into
Shopify:mainfrom
wanxiankai:fix/render-phase-pending-child
Open

fix(recyclerview): prevent orphaned pending child layouts#2378
wanxiankai wants to merge 1 commit into
Shopify:mainfrom
wanxiankai:fix/render-phase-pending-child

Conversation

@wanxiankai

Copy link
Copy Markdown

Description

Fixes #2319

Move nested RecyclerView pending-layout registration from the render phase to a layout effect. This prevents interrupted or otherwise discarded renders from adding an ID to the parent list's pendingChildIds set without a matching commit that can remove it.

Add an unmount cleanup that releases the child ID when a nested list is removed before its first layout completes. The existing horizontal-list early-unmark behavior remains intact by skipping the commit-phase mark once a horizontal child already has a measured height.

Without these changes, an orphaned ID can make the parent list's relayout effect return early on every later commit, leaving item offsets and content size permanently stale until the parent remounts.

Reviewers’ hat-rack 🎩

  • Confirm commit-phase registration preserves first-layout coordination for nested lists.
  • Confirm horizontal children are not re-marked after the existing early-unmark path.
  • Confirm unmount cleanup is safe when the child already completed and unmarked its first layout.

Screenshots or videos (if needed)

Not applicable; this changes layout lifecycle coordination without a deterministic visual state.

Testing

  • Added regression coverage for a render that throws before commit and must not mark its parent.
  • Added regression coverage for unmounting a pending nested list and releasing its ID.
  • yarn test --runInBand (14 suites, 189 tests)
  • yarn lint
  • yarn type-check
  • yarn build
  • Prettier check for the changed files

@wanxiankai wanxiankai changed the title [codex] prevent orphaned pending child layouts fix(recyclerview): prevent orphaned pending child layouts Jul 13, 2026
@wanxiankai

Copy link
Copy Markdown
Author

I have signed the CLA!

@wanxiankai
wanxiankai marked this pull request as ready for review July 13, 2026 15:11
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.

Render-phase markChildLayoutAsPending can orphan pendingChildIds, permanently freezing the parent relayout effect (items overlap/jam until remount)

1 participant