Skip to content

Cannot use useTrackRenders when component is used in the wrapper option #7

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

Closed
jerelmiller opened this issue Nov 4, 2024 · 2 comments

Comments

@jerelmiller
Copy link
Collaborator

When using renderStream.render, I am unable to to use components that use the useTrackRenders hook in the wrapper option. As an example, see this test from an Apollo Client bug that I'm working on. I'd like to move the <Suspense /> and <ErrorBoundary /> components to the wrapper option. When doing so however, I see the error:

useTrackRenders: A Render Stream must be created and rendered to track component renders

Ideally useTrackRenders can be used for components in the components passed to render and wrapper. This would also make it easier for more of these complex cases to use rerender to avoid the need to pass that whole component tree again.

@phryneas
Copy link
Member

phryneas commented Nov 5, 2024

Good point. We probably need to swap ParentWrapper and Wrapper for that here:

<ParentWrapper>
<Wrapper>{props.children}</Wrapper>
</ParentWrapper>

@jerelmiller
Copy link
Collaborator Author

Closing as the argument against this change makes sense. Sticking with the rule of "components that track renders should be part of the test" makes a lot of sense to me and should help reduce confusion.

@jerelmiller jerelmiller closed this as not planned Won't fix, can't repro, duplicate, stale Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants