Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No access to fields on old an new value in a typePolicy.merge function #11221

Open
phryneas opened this issue Sep 15, 2023 · 2 comments
Open
Labels
🔍 investigate Investigate further

Comments

@phryneas
Copy link
Member

Issue Description

This came up here on Discord:

If an object is overwritten with a new object of the same id, both incoming and existing are ref objects with the same value, so readField will return the same value for both incoming and existing refs. The Discord user reported this to be the value of existing, in my reproduction it's the value of incoming.

This doesn't seem something that can easily be fixed and would either require a different kind of ref, or an api change (readExistingField? 😒 ).

Not sure what exactly the plan should be here, but I thought I'd create an issue so we can track it, as this seems like a valid use case.

Link to Reproduction

41b4c45

Reproduction Steps

See the test.

@mogelbrod
Copy link

Encountered this today, and only found this after a couple of hours of debugging and googling. Given that existing and incoming are named they way they are it's very confusing to not be able to access the old data via existing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔍 investigate Investigate further
Projects
None yet
Development

No branches or pull requests

4 participants