Skip to content

Cache Read Failure in List with Nullable Items When Null Present #3527

Open
@mlarandeau

Description

@mlarandeau

Summary

We have various fields in our schema whose types are a nullable List containing nullable items (someField: [SomeType]) where the item type is a Union of a handful of other types. When parsing the live response there are no problems. However, when reading from the local cache, the read fails with JSONDecodingError.wrongType when one of the items within the list is null.

Version

1.15.2

Steps to reproduce the behavior

Setting some breakpoints within the Apollo SDK, I found that the error was being thrown from here. When inspecting the types, value was a CacheReference which that guard is trying to cast to a Record. Interestingly, when comparing the success and failure situations, I found that on success, when the list itself reaches that same line and is subsequently passed to executeChildSelections, the records for the items within the list are retrieved from the cache before circling back to the GraphQLExecuter. However, in the failure case, the item records never appear to be queried from the cache which presumably is how the CacheReferences end up getting passed back to the GraphQLExecutor.

I have only looked at this within the context of the memory cache and the data appears to write to the cache successfully.

So far we have verified this with two different fields/types in our schema but have heard additional reports that the "cache is not working".

Logs

Anything else?

Is there anything on our end that we should verify that we have configured properly?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions