Akash Amin
11/27/2024, 7:13 PMpublish
, wanted to know if there is a change how query watchers are triggered as compared to Apollo v2? I did verify via the dump
and we do have a record with the cache key I am trying to publish. There is no actual change in the record it's just a trigger to update the UI state.mbonnin
11/27/2024, 7:24 PMmbonnin
11/27/2024, 7:25 PMUser:42
• field key: User:42.name
mbonnin
11/27/2024, 7:25 PMpublish()
with?Akash Amin
11/27/2024, 7:26 PM{
__typename: "user",
id : "42",
flag: true //or any other fields
}
publish("42")
mbonnin
11/27/2024, 7:28 PMpublish("42.id")
?mbonnin
11/27/2024, 7:28 PMmbonnin
11/27/2024, 7:28 PMpublish("42.flag")
too (id is quite a special flag)Akash Amin
11/27/2024, 7:37 PMAkash Amin
11/27/2024, 7:39 PMpublish("42.id")
? Should I not be using id
?mbonnin
11/27/2024, 8:36 PMnot sure I read about this anywhere in the migration guideGood callout. I’ll add something.
Also forgot to mention it worked with the fieldUsing? Should I not be usingpublish("42.id")
id
id
is fine the important thing is to use a field that is aueried by your query
I am a bit confused though, field publishes are required to filter out unwanted publishes by the object itself?Imagine you have a top level
post
and a 2 queries, 1 that gets the likes and the other get the contents.
If we notify based on the post id, both queries are potentially refetched when you only want to refetch likes (and contents is much larger)mbonnin
11/27/2024, 8:44 PMAkash Amin
11/27/2024, 8:46 PM