apollo-cache-persist icon indicating copy to clipboard operation
apollo-cache-persist copied to clipboard

Don't persist @client fields?

Open amilich opened this issue 1 year ago • 3 comments

Is it possible to not persist local-only fields (@client) in the persisted cache?

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

amilich avatar Mar 28 '23 00:03 amilich

same here.

jingp-ofload avatar Sep 09 '23 21:09 jingp-ofload

Hello!

I believe we don't have any specific support for local-only fields. Does the result of your field's policy read() function get persisted?

There was a custom Persistence Mapper example that modfied the cache behaviour based on query directives. You could take inspiration from there.

I could have a look if you provide a minimal reproduction.

wodCZ avatar Sep 10 '23 11:09 wodCZ

Forgive my foolish here. What I meant was Persist @client field.

jingp-ofload avatar Sep 10 '23 23:09 jingp-ofload