Skip to content
This repository has been archived by the owner on Jul 6, 2020. It is now read-only.

Skip writing undefined fields and warn in dev #71

Merged
merged 2 commits into from
Sep 9, 2019

Conversation

kitten
Copy link
Member

@kitten kitten commented Sep 9, 2019

We hit a case where an undefined value was written to the cache which lead to an incomplete query. This will most likely occur with invalid updateQuery calls or invalid optimistic results that include undefined fields, where the query expects a value.

We now skip writing these fields and instead warn about them. It should never be acceptable to write undefined to the cache, as we only want to write null. In rare cases undefined will indeed be written to remove records, but that's done with the explicit store.removeRecord call.

We're indeed seeing some warnings for this case in the write.test.ts tests, but I'm pretty sure those were expected before.

@kitten kitten requested a review from JoviDeCroock September 9, 2019 23:15
Copy link

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a test for this case, this will avoid us encountering this bug in the future

@kitten kitten requested a review from JoviDeCroock September 9, 2019 23:28
@kitten kitten merged commit 91cd962 into master Sep 9, 2019
@kitten kitten deleted the fix/warning-for-undefined branch September 9, 2019 23:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants