Closed kitten closed 4 months ago
Latest commit: 38d31944630bc86308331887bf290de86fbfd389
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
See related PR: https://github.com/urql-graphql/urql/pull/3503
Summary
When
cache.resolve
returns a list of entity links, i.e. an array link, a user may be tempted to mutate this list before writing it back to the store.This can have unforeseen consequences if:
cache.link
then doesn't write to the same layercache.link
isn't called at allThis is because, unlike
cache.link
,cache.resolve
doesn't make a copy of links before returning them. This means that mutating a link array leads to direct modifications to the internal caching layer.Set of changes
ensureLink
before returning the links viacache.resolve
to copy them