facebook/react · error · Error

The children should not have changed if we pass in the same

Error message

The children should not have changed if we pass in the same set.

What it means

Diffing invariant in updateChildrenRecursively's keyed-set fast path: when the parent passes the exact same child set, the recursive child update is expected to bail out without requesting a child reset (ShouldResetChildren). Getting that flag anyway means filtered-fiber bookkeeping diverged - a child decided the set membership changed even though the caller asserted it identical.

Source

Thrown at packages/react-devtools-shared/src/backend/fiber/renderer.js:4766

              // we should fall back to recursively marking the nearest host descendants for highlight.
              if (traceNearestHostComponentUpdate) {
                const hostInstances =
                  findAllCurrentHostInstances(fiberInstance);
                hostInstances.forEach(hostInstance => {
                  traceUpdatesForNodes.add(hostInstance);
                });
              }
            }
          } else {
            const childrenUpdateFlags = updateChildrenRecursively(
              nextFiber.child,
              prevFiber.child,
              false,
            );
            // If this fiber is filtered there might be changes to this set elsewhere so we have
            // to visit each child to place it back in the set. We let the child bail out instead.
            if ((childrenUpdateFlags & ShouldResetChildren) !== NoUpdate) {
              throw new Error(
                'The children should not have changed if we pass in the same set.',
              );
            }
            updateFlags |= childrenUpdateFlags;
          }
        }
      }

      if (fiberInstance !== null) {
        // Detect Activity hidden/visible mode changes.
        if (
          prevFiber.tag === ActivityComponent &&
          nextFiber.tag === ActivityComponent &&
          fiberInstance.kind === FIBER_INSTANCE
        ) {
          const prevOffscreen = prevFiber.child;
          const nextOffscreen = nextFiber.child;
          if (prevOffscreen !== null && nextOffscreen !== null) {

View on GitHub (pinned to eafeac097b)

Solutions

  1. Update React DevTools to the latest build
  2. Clear or simplify component filters and reload the page, then retry the update
  3. Re-report with the active filters and the component tree shape if it persists
  4. Disable the Components panel temporarily to confirm the error source
Defensive patterns

Strategy: try-catch

Try / catch

try {
  backend.handleCommitFiberRoot(renderer, root);
} catch (e) {
  if (/children should not have changed if we pass in the same set/.test(e.message)) {
    clearFiltersAndRemount(root); // filtered-set bookkeeping diverged
  } else throw e;
}

Prevention

When it happens

Trigger: Components filtered out by DevTools' component filters interacting with keyed children sets; toggling filters while updates commit; version skew in the filtered-instance placement logic between commits.

Common situations: Using DevTools component filters (hide by name/type) on trees whose children reconcile as keyed sets; changing filter settings mid-session and then triggering updates.

Related errors


AI-assisted analysis of facebook/react@eafeac097b (2026-08-21). Data as JSON: /api/errors/7b0b6fa479ba50b9. Report an issue: GitHub.