Skip to content

fix(SwitchTransition): handle null children during transitions - #939

Open
Aminark wants to merge 2 commits into
reactjs:masterfrom
Aminark:fix/switch-transition-null-child
Open

Aminark wants to merge 2 commits into
reactjs:masterfrom
Aminark:fix/switch-transition-null-child

Conversation

@Aminark

@Aminark Aminark commented Oct 25, 2026

Copy link
Copy Markdown

Rendering null while a child is entering or exiting throws React.cloneElement(...): The argument must be a React element, but you passed null. The child is cleared, but the transition status still sends render through the active transition path.

Reset the status when clearing the child. The regression covers both phases in out-in and in-out mode, including rendering a child again afterward. All four cases fail before the fix.

Validation: all 60 Jest tests pass. ESLint and Prettier pass for the changed files.

This branch has not been deployed

No deployments
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.

1 participant