Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Slots without a context prop results an infinite render loop #2187

Closed
iansan5653 opened this issue Jul 25, 2022 · 0 comments · Fixed by #2219
Closed

Using Slots without a context prop results an infinite render loop #2187

iansan5653 opened this issue Jul 25, 2022 · 0 comments · Fixed by #2219
Labels
bug Something isn't working react

Comments

@iansan5653
Copy link
Contributor

The context prop on the Slots component generated by createSlots is marked as optional:

context?: ContextProps['context']

However, not providing this prop causes an infinite render loop. The result will look fine, but a check of the console will show that it never stops rendering:

Error: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.

This bug is really hard to figure out since there's no hints as to what causes the issue.

Even just setting the prop to an empty object (<Slots context={{}}>) fixes the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working react
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants