basequery state changing cause infinite rerender
I try to use react component extension to debug the rerender in my code and found that this state change is the cause. I am not sure what's the problem here it's keep changing all the time. Is there anyway to stop this? btw, I am still on trpc9
2 Replies
Can you share the code from around that component?
Chances are you have some useEffect which keeps invalidating or refetching. It’s a common React pitfall
Or a parameter to the query which isn’t stable and keeps causing a refetch possibly
This could help https://github.com/welldone-software/why-did-you-render
GitHub
GitHub - welldone-software/why-did-you-render: why-did-you-render b...
why-did-you-render by Welldone Software monkey patches React to notify you about potentially avoidable re-renders. (Works with React Native as well.) - GitHub - welldone-software/why-did-you-render...