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

fix: Calling Parse.Object.relation.add multiple times on an on object does not work #2057

Closed
wants to merge 2 commits into from

Conversation

mstniy
Copy link
Contributor

@mstniy mstniy commented Nov 23, 2023

Pull Request

Issue

Closes: #2056

Approach

_ensureParentAndKey writes a fresh parent reference to the relation object.

Tasks

  • Add tests
  • Add changes to documentation (guides, repository pages, code comments)

Copy link

Thanks for opening this pull request!

@mstniy mstniy changed the title Fix #2056 fix: Calling .add multiple times on relations is broken #2056 Nov 23, 2023
Copy link

codecov bot commented Nov 23, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fea8edf) 100.00% compared to head (5dbd5e1) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##             alpha     #2057   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           61        61           
  Lines         6178      6175    -3     
  Branches      1496      1494    -2     
=========================================
- Hits          6178      6175    -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

integration/test/ParseRelationTest.js Outdated Show resolved Hide resolved
@@ -50,12 +50,9 @@ class ParseRelation {
if (this.parent.id !== parent.id) {
throw new Error('Internal Error. Relation retrieved from two different Objects.');
}
} else if (parent.id) {
Copy link
Member

Choose a reason for hiding this comment

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

Do you know what as the purpose of this parent.id check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really. My educated guess is that it checks if the parent has been saved.

Copy link
Member

Choose a reason for hiding this comment

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

I believe we'd need to understand this logic better and the purpose of the parent.id check before we remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. Unfortunately my team doesn't have the capacity for that, but we'd be more than happy to review/discuss any findings in this direction.

integration/test/ParseRelationTest.js Outdated Show resolved Hide resolved
Co-authored-by: Manuel <[email protected]>
Signed-off-by: Kartal Kaan Bozdoğan <[email protected]>
@mtrezza mtrezza changed the title fix: Calling .add multiple times on relations is broken #2056 fix: Calling Parse.Object.relation.add multiple times on an on object does not work Dec 2, 2023
@mstniy
Copy link
Contributor Author

mstniy commented Jan 21, 2024

Closing in favor of #2078

@mstniy mstniy closed this Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calling .add multiple times on relations is broken
2 participants