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
I have a watchQuery with fetchPolicy network-only and nextFetchPolicy cache-first that returns an object with initially empty things.
Later, I add things to the object via cache.modify.
The watchQuery is triggered, it now contains the things.
Later, I call readQuery which updates one of the things with a new value.
I expect the watchQuery to be triggered again, with the new value for the thing.
Like writeQuery and writeFragment, modify triggers a refresh of all active queries that depend on modified fields (unless you override this behavior by passing broadcast: false).
The text was updated successfully, but these errors were encountered:
Narretz
changed the title
Updating object added with cache.modify doesn't trigger watchQuery update
Updating object added with cache.modify doesn't trigger watchQuery update (has failing unit test)
Feb 17, 2022
Intended outcome:
I have a watchQuery with fetchPolicy
network-only
and nextFetchPolicycache-first
that returns an object with initially emptythings
.Later, I add
things
to the object viacache.modify
.The
watchQuery
is triggered, it now contains thethings
.Later, I call
readQuery
which updates one of thethings
with a new value.I expect the
watchQuery
to be triggered again, with the new value for the thing.See this unit test: #9439
the documentation says:
https://www.apollographql.com/docs/react/caching/cache-interaction/#using-cachemodify
Actual outcome:
After readQuery, the watchQuery is not triggered.
It is however triggered if I use cache.updateQuery to add the things.
That leads me to believe that this is a bug.
How to reproduce the issue:
I've added a failing unit test here:
#9439
Versions
Unit test ran against 3.5.9
The text was updated successfully, but these errors were encountered: