Best way to implement delivery confirmation/read status #1329
-
|
My client is receiving messages in two possible ways:
I'd like to send out a mutation when the messages are received (delivery confirmation). As well as when they are first displayed (read status). I'm trying to figure out the best place to trigger such a mutation. I think read status modification should always happen in the displaying components. However I feel that triggering a mutation at the start of a component render may not be a great thing to do. Delivery confirmation I'd prefer to handle in the caching layer since all data flows through it so it knows best when something was delivered. However, I'm not sure whether it's considered bad practice to trigger requests from the cache layer (or quite the best way to approach it). Ideally in either scenario I'd prefer to perform the change in a single request (although they can be separate mutations). I haven't been able to find any existing literature on this subject in GraphQL in general, so would be happy to hear any thoughts on the subject. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
|
Let's tackle this hypothetically, in this scenario we have
I honestly don't think this should be a concern in an exchange/cache since this doesn't accurately follow along with the React-layer if we're talking a suspsenseful or concurrent world. |
Beta Was this translation helpful? Give feedback.
Let's tackle this hypothetically, in this scenario we have
TextBubble, when aTextBubblefinished rendering we are aware the user seen this:useEffectonly fires when a dom-commit happens. Another way to go about this is with a callback, we aggregate the unread message ids and when a user would tap the input-component we'd mark them as read.I honestly don't think this should be a concern in an exchange/cache since this doesn't accurately follow along with the React-layer if we're talking a suspsenseful or concurrent world.