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
Thank you for all the great pioneer work on making live queries possible, this could really bring graphql to a whole new level.
While thinking about scaling this solution to a large scale production app it came to my mind that it might be useful to be able to use the @live directive on single fields and not on the whole query. Especially if we follow the concepts explained in Unleash the power of Fragments with GraphQL Codegen, the goal is to have one main query that retrieves all data a page needs.
If we only need part of the data to be realtime, declaring the live directive on single fields might save a lot of overhead and would also make things more predictable. The directive could also implement an argument to specify whether it should be applied recursively to child fields.
Another benefit I see in this approach is that the directive could then implement an argument for accepting additional resource identifiers.
Like if we have a field that contains a list of calendar events that all belong to user:4 or user:6, we could add a list of resource identifiers like [ 'user:4', 'user:6' ] that can all be used to invalidate the list. This would allow to invalidate the list only for a subset of the subscribers of the event list.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi!
Thank you for all the great pioneer work on making live queries possible, this could really bring graphql to a whole new level.
While thinking about scaling this solution to a large scale production app it came to my mind that it might be useful to be able to use the
@live
directive on single fields and not on the whole query. Especially if we follow the concepts explained in Unleash the power of Fragments with GraphQL Codegen, the goal is to have one main query that retrieves all data a page needs.If we only need part of the data to be realtime, declaring the live directive on single fields might save a lot of overhead and would also make things more predictable. The directive could also implement an argument to specify whether it should be applied recursively to child fields.
Another benefit I see in this approach is that the directive could then implement an argument for accepting additional resource identifiers.
Like if we have a field that contains a list of calendar events that all belong to
user:4
oruser:6
, we could add a list of resource identifiers like[ 'user:4', 'user:6' ]
that can all be used to invalidate the list. This would allow to invalidate the list only for a subset of the subscribers of the event list.I'd love to hear your thoughts on this. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions