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

Improve keyFields error behavior when primary key fields are missing #8679

Merged
merged 3 commits into from
Aug 26, 2021

Conversation

benjamn
Copy link
Member

@benjamn benjamn commented Aug 20, 2021

Building on #8678 (only because it touches the same code), this PR seeks to improve the way computeKeyFieldsObject behaves when it fails, in two ways:

  • The cache.identify method (which ultimately calls computeKeyFieldsObject when keyFields is configured) will no longer throw under any circumstances, instead returning undefined to indicate failure (as usual).
  • The error message thrown when computeKeyFieldsObject fails will now include the object that was missing the desired field, making it much easier to tell why the error happened (as suggested by @jorbuedo in keyFields mismatch with query leads to hard Invariant Violation crash #6673 (comment)).

This may not be a full solution to #6673, but I'm sure it will help.

@benjamn benjamn self-assigned this Aug 20, 2021
@benjamn benjamn requested a review from brainkim August 20, 2021 20:10
@hwillson hwillson added this to the Release 3.5 milestone Aug 24, 2021
@benjamn benjamn force-pushed the allow-directives-and-variables-in-field-key-policy branch from adc3b73 to 0c4c008 Compare August 25, 2021 18:36
Base automatically changed from allow-directives-and-variables-in-field-key-policy to release-3.5 August 25, 2021 21:37
@benjamn benjamn force-pushed the improve-keyFields-error-behavior branch from 30857d7 to e1b737f Compare August 25, 2021 22:01
@benjamn benjamn requested a review from hwillson August 25, 2021 22:05
Copy link
Member

@hwillson hwillson left a comment

Choose a reason for hiding this comment

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

🎉 thanks @benjamn!

@benjamn benjamn merged commit 2710481 into release-3.5 Aug 26, 2021
@benjamn benjamn deleted the improve-keyFields-error-behavior branch August 26, 2021 15:52
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants