-
I have the following mutation: renameAction(actionId: UUID!, name: String!): Action!
Is there a better way to handle such cases with optimistic updates other than specifying manually all entity fields while reading it from the cache? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Ultimately you will get warnings if you're missing a field in your optimistic result, along the lines of:
But you may notice that this will be issued as a warning. That's because you may have forgotten to return an update for a specific field, but that doesn't mean that this field is necessarily changing. So it's actually safe to ignore this warning at times (and all warnings are muted in production) So in theory, all fields that you're reading in Basically, if you're just renaming your action, then it stands to reason that your mutation will only change (and contain) a couple of fields. So given that, this could make your optimistic result very short in turn as well. |
Beta Was this translation helpful? Give feedback.
Ultimately you will get warnings if you're missing a field in your optimistic result, along the lines of:
But you may notice that this will be issued as a warning. That's because you may have forgotten to return an update for a specific field, but that doesn't mean that this field is necessarily changing. So it's actually safe to ignore this warning at times (and all warnings are muted in production)
So in theory, all fields that you're reading in
readFragment
to "complete" your optimistic result can be left out. Actually we wanted to ignore this warning if the field was explicitly set toundefined
, but I belie…