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.61k stars 449 forks source link

fix(graphcache): Fix reference equality of lists not always being preserved #3228

Closed kitten closed 1 year ago

kitten commented 1 year ago

Summary

A prior fix in #3165 prevented us from mixing API and Graphcache’s data. While we previously avoided modifying API data or prior results from Graphcache, this created new corner cases that were hard to cover.

Specifically, nested lists are hard to diff against prior results as they can be re-entered, null must be skipped, and there’s more cases where comparing data and returning previous results could be dangerous and lead to the wrong outcome.

This PR aims to start addressing this issue but may forget to cover some corner cases.

Set of changes