When to use watchQuery or query in Apollo-Angular?
18,795
query
is something you just query for once, you can consider it as an equivalent of GET.
watchQuery
is something you constantly keep a watch on query, whenever that query will be refetched or the data related to that query is changed from anywhere else, this method will keep on emitting the updated data.
It's really simple, you can read the docs here.
Related videos on Youtube
Author by
yussenn
Updated on June 05, 2022Comments
-
yussenn almost 2 years
I am using a watchQuery or query in Apollo-Angular (graphql)
How is the logic and difference of the watchQuery and query
-
Paul Razvan Berg over 4 yearsWhat is the difference between
watchQuery
and subscriptions? -
chris almost 4 years@PaulRazvanBerg good question since this is causing a lot of confusion.
watchQuery
will continue to emit results, as long as this data changes in Apollo's cache memory store. Subscriptions will emit results based on changes/events from the server side. -
writofmandamus over 3 yearsBroken link now