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

"UnnamedContext" given as reason for rerender, but doesn't seem right #330

Closed
agos opened this issue Mar 14, 2025 · 3 comments
Closed

"UnnamedContext" given as reason for rerender, but doesn't seem right #330

agos opened this issue Mar 14, 2025 · 3 comments

Comments

@agos
Copy link

agos commented Mar 14, 2025

I'm trying to pinpoint the reason for some unnecessary re renders with the "What's changed" feature of React Scan, but I've got to a point where it indicates a change in "UnnamedContext" as the reason ("Reference changed but objects are the same"), but I'm pretty sure that Context (which is not really unnamed) is not changing.

First it was the Query Param Provider from use-query-params, so I tried removing that. Then it told me it was a Context of mine to expose some methods which was already under useMemo, so I removed that too. Now it's pointing to what seems to be TanStack Query's Error Reset Boundary.

I believe React Scan is wrong here, and it's probably something to react-hook-form, but I don't know how to debug it further. I'm willing to try out stuff to help understand what's happening, but unfortunately I can't share my project

@RobPruzan
Copy link
Collaborator

Should be fixed in #337, let me know if you're still seeing the issue

@agos
Copy link
Author

agos commented Mar 17, 2025

it's way better now, thanks! Now I'm getting references to hooks and their number which is both correct and a lot more actionable.

It would be nice to have the hook name instead of the number but it's a separate issue and possibly related to facebook/react#31398

Thanks for fixing this so quickly!

@agos agos closed this as completed Mar 17, 2025
@RobPruzan
Copy link
Collaborator

it's way better now,

Great to hear!

It would be nice to have the hook name instead of the number but it's a separate issue and possibly related to facebook/react#31398

I checked out the impl, and the solution does seem like it would take a bit of time to get right. Probably can't do this immediately but I do think this would be very useful to add in the future

MLH-Fellowship/react#115

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

No branches or pull requests

2 participants