react / react/react

Child reconciliation does not close iterators when a yielded child throws

Open
#37,441 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
251k
Forks
51.4k
Avg merge
2d 4h
Merged PRs (30d)
53

Description

React version

Current main (2dc7da790d63).

Steps to reproduce
  1. Render a synchronous or enabled asynchronous iterable as children.
  2. Have its iterator implement return() (or generator cleanup in finally).
  3. Yield an invalid child that makes reconciliation throw.
  4. Inspect whether the underlying iterator is closed.
Current behavior

The reconciler manually consumes child iterators but does not call return() when child creation/update throws. Generator cleanup/resource release remains open. The async-iterable adapter also exposes only next(), so even shared close handling could not reach the underlying async iterator.

Expected behavior

Close each iterator exactly once on abrupt reconciliation, forward close through the async adapter, and preserve the original reconciliation error.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with synchronous and enabled asynchronous iterables, then locate the child reconciler's manual iterator consumption and the async-iterable adapter. Verify abrupt child errors, iterator return() or generator cleanup, and original-error preservation. Done means each iterator closes exactly once, async closure reaches the underlying iterator, and reconciliation still reports the original error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.