-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
Hey, first of all thank you for the library.
I have a question, maybe I misses something:
Why useQuery provokes 2 extra renders in react? Instead it should only provoke:
- one render if I don't read loading/loaded variable, only when the data is ready
- two renders if I read them - one fore
loading = true, loaded = falseand the second one forloading = false, loaded = true
But for some reason, I see 3 or some times 4 renders:
const { data, loading, loaded } = useQuery(myQuery, variables);
render | loading | loaded | data
-------------------------------------------
1 | false | false | null - expected
2 | true | false | null - expected
3 | true | false | null - why ????
4 | true | false | null - why ????
5 | false | true | { data } - expected
PS. I'm trying to optimize the code and to reduce the amount of unnecessary renders, and I found this unexpected behavior. (Apollo client doesn't have it)
BTW. useSuspenseQuery works as expected, but it has different issue I posted in the separate topic
Metadata
Metadata
Assignees
Labels
No labels