vuejs / apollo

🚀 Apollo/GraphQL integration for VueJS
http://apollo.vuejs.org
MIT License
6.03k stars 523 forks source link

How to use field policies / local only fields #1567

Open rnenjoy opened 3 months ago

rnenjoy commented 3 months ago

Describe the bug Is it possible to use field policies / local only fields with vue-apollo?

https://www.apollographql.com/docs/react/local-state/managing-state-with-field-policies/

Versions vue: vue-apollo: @apollo/client:

Additional context Add any other context about the problem here.

nickmessing commented 3 months ago

@rnenjoy it works exactly as in react, you add fields decorated as @client and resolve them on the client-side cache implementation.

However, I would recommend you keep the queries as-is and use vue's computed to calculate extra data as using @client doesn't allow for any type-generation. If you're not using typescript - it's fine.