-
This might be a very well known issue, but I couldn't find the answer for It seems like Why does this happen ? any workaround ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
It's not quite a re-render and this is expected behaviour and required, especially to comply with the rules of concurrent mode for concurrent mode safety, suspense, and the rules of hooks in general. What's actually happening is that the initial mount has consistent state with the subsequent renders, but the effect will have to actually start the side-effects of executing queries, so they will at least call The |
Beta Was this translation helpful? Give feedback.
It's not quite a re-render and this is expected behaviour and required, especially to comply with the rules of concurrent mode for concurrent mode safety, suspense, and the rules of hooks in general. What's actually happening is that the initial mount has consistent state with the subsequent renders, but the effect will have to actually start the side-effects of executing queries, so they will at least call
setState
once to update the result, even if it's identical to the last, since it may have changed from the time of render.The
useQuery
code inurql
is pretty optimised, but has also been rewritten to comply to as many guidances and rules of the React team as possible to ensure that it…