-
Notifications
You must be signed in to change notification settings - Fork 2
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
Query watcher re-emitting old value after caches are cleared #78
Comments
Each query watchers internally builds set that called The behaviour you see is totally legit as seems like in your example |
I expected something like this. So is this also what's happening when both queries return empty lists? Since in that case none of the returned objects (in both queries) even have an ID for the normalized cache, so I'd expect the first query to actually never emit again. Unless the top-level common object (also without an ID) triggers this new emission as well. Only if this happens, we'd be emitting unnecessarily all the time :/ |
Yeah and this behaviour was added after fixing this issue apollographql/apollo-kotlin#822 |
I'm facing some weird behavior, which I'm not even sure if it's a bug or intended behavior. If the second, I'm curious what's the reasoning.
I have two different queries, and (probably related) each of them contains objects of the same types: QueryOne fetches
[A]
and[B]
, and QueryTwo also fetches[A]
and[B]
. What I'm doing then is I:QueryOne
QueryTwo
On the third step, when watching
QueryTwo
, the first watcher forQueryOne
emits again, with the previous data. This is pretty unexpected, because it happens even when there are no common items between both queries. In particular it happens when all the returned lists in both queries are empty.Is this simply lack of optimization, or a bug? Previously I expected that
QueryOne
might emit again ifQueryTwo
actually updates some object returned byQueryOne
, but with empty lists I'm not so sure. Might it be because both queries return the same root, under which[A]
and[B]
are then nested?Sorry for unclear example, but as usual this happens with our production schema which I'm not sure I can share :\
This is with Apollo 1.2.3
The text was updated successfully, but these errors were encountered: