Partial mutations with vuex-orm over graphql?

50 Views Asked by At

Background: I use mongodb where a typical document may contain fields with large values. A description field may hold over 200KB.

The same document also contains a title field which is limited to 64 characters (max).

I’d like to setup the code so that it's more network-efficient when the user modifies title.

Current state: I use doc.$push() to store the changes in the document. Spec is: https://vuex-orm.github.io/plugin-graphql/guide/push.html

In this case the browser devtools network tab shows that the whole document is being sent, including the description despite not being modified. Needless to say, that's an unreasonable overhead for such a network request.

How do I set it up so that only the title value is included and sent in the network request?

One approach is to use apollo-client with a custom mutation query updating only title. This approach ends up messing up the codebase because there are more collections and more fields which are required to update without resending the whole document. So really, I seek a generic approach.

So, any ideas as for how to execute partial mutations with vuex-orm over graphql?

0

There are 0 best solutions below