You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My intention is to load the query from the server initially and when the user clicks a button load a new one. The state is not used the query logic.
The error occurs when the setState() function is called. I think what's happening is when the setState triggers a re-render, the useQueryLoader inputs also change and cause a second re-render. The second re-render causes React to detect an infinite render loop, throwing an error.
In my project, I have fixed (maybe? - I'm not a React+Relay expert) this issue by wrapping the return value in the useMemo call like so:
I ran into an issue with NextJS v13 useSerializablePreloadedQuery example which caused react to throw an error due to too many renders.
I have a setup similar to
MainViewClientComponent
, but I have:My intention is to load the query from the server initially and when the user clicks a button load a new one. The state is not used the query logic.
The error occurs when the
setState()
function is called. I think what's happening is when thesetState
triggers a re-render, theuseQueryLoader
inputs also change and cause a second re-render. The second re-render causes React to detect an infinite render loop, throwing an error.In my project, I have fixed (maybe? - I'm not a React+Relay expert) this issue by wrapping the return value in the
useMemo
call like so:Is that the correct approach?
The text was updated successfully, but these errors were encountered: