urql-graphql / urql

The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
https://urql.dev/goto/docs
MIT License
8.6k stars 448 forks source link

fix(graphcache): Re-enable offlineExchange issuing non-cache request policies #3308

Closed kitten closed 1 year ago

kitten commented 1 year ago

Summary

This PR, when applied, makes two changes.

Primarily, requesdt policies other than cache-first are now allowed in the offlineExchange when re-running failed operations. After rehydration or when replaying failed queries, queries will now not be forced to cache-first policies, and instead use the highest policy that was issued, preferring network policies (cache-only < cache-first < network-only < cache-and-network).

Additionally, instead of checking manually which mutations have made optimistic changes, the cacheExchange will now mark optimistic mutations' contexts with optimistic: true instead.

Set of changes