when variable is aliased (in this case limit as $l) then readQuery doesn't find it.
In my example I used cache.inspectFields to be sure that query is cached and calling it with riight arguments.
If query use same name for query and field variable than all is ok.
Tried to debug it little in browser. Query is properly store in cache (with right key), but underlying readLink/getNode uses wrong fieldKey.
For complex queries with more argument, the key is missing aliased argument and then doesn't match key under which is query stored in cache. Attaching trace with place when lookup fails.
Eventually I realized it's not a bug.
What's inconvenient, that original query document can't be used in readQuery / updateQuery calls, bacause stored arguments has different names than accpets query.
Describe the bug
Let's use https://github.com/FormidableLabs/trygql/blob/main/graphql/intermittent-colors/__generated/schema.gen.graphql for reproduction
Even with minimalistic query
when variable is aliased (in this case limit as $l) then readQuery doesn't find it. In my example I used cache.inspectFields to be sure that query is cached and calling it with riight arguments.
If query use same name for query and field variable than all is ok.
Tried to debug it little in browser. Query is properly store in cache (with right key), but underlying readLink/getNode uses wrong fieldKey. For complex queries with more argument, the key is missing aliased argument and then doesn't match key under which is query stored in cache. Attaching trace with place when lookup fails.
Reproduction
https://github.com/farin/urql-cache-bug/blob/main/index.mjs
Urql version
@urql/exchange-graphcache v6.4.1
Validations