-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
fix(datastore): remove connections with model field as undefined #10983
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #10983 +/- ##
==========================================
- Coverage 85.65% 81.90% -3.76%
==========================================
Files 196 194 -2
Lines 18261 19376 +1115
Branches 3892 4179 +287
==========================================
+ Hits 15642 15870 +228
- Misses 2543 3217 +674
- Partials 76 289 +213
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I couldn't consolidate my feedback into fewer rounds on this. Slow brain days. 🙁
const childWithoutParent = CompositePKChild.copyOf(child, draft => { | ||
draft.parent = null; | ||
}); | ||
|
||
expect(await childWithoutParent.parent).toBeUndefined(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I didn't think of all the feedbacks in one round. 😓 But, can we extend all of these tests a little to ensure parent nullification is saved correctly? I.e.,
- Save the copied child without parent.
- Retrieve the copied child.
- Ensure the nullified parent is persisted correctly.
I'm also not clear on whether we need to confirm the round-trip to cloud storage successfully persists the removal there. Are we sure the right mutations are being generated? Have you tried it manually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the tests to include assertions on the parent was well. I have tested manually using the original reproduction steps and it is persisting in cloud. Do you think we should add an E2E test for this as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should add an E2E test for this as well?
Yes. It would also be nice to clamp the e2e behavior on this against our gql fake in the no-longer-accurately-named connectivityHandling
tests.
Both of those are nonblocking IMO. Get the fix out sooner rather than later. But, one and/or both of those should be fast-followups, IMO, to guard against regression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the iterations!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🎉
Description of changes
Allows removal of connection using the model field instead of the join fields.
Example:
Given the following schema:
In order to remove a child from the parent the join field (
parentChildId
) must be set to undefined rather than the direct model field (child
).With the change
draft.child = undefined
will now also remove the connection.Issue #, if available
Resolves #10750
Description of how you validated changes
Tested with minimum repro above.
Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.