Skip to content

fix(pinia-orm): Two same belongsToMany with inverse keys on same model are causing wrong saved data #1860

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

Merged
merged 2 commits into from
May 24, 2024

Conversation

CodeDredd
Copy link
Owner

@CodeDredd CodeDredd commented May 24, 2024

🔗 Linked issue

resolves #1857

📚 Description

This edge case is causing wrong saved data if defined on the same model:

...
          retailers: this.belongsToMany(Client, ClientRetailer, 'supplierId', 'retailerId'),
          suppliers: this.belongsToMany(Client, ClientRetailer, 'retailerId', 'supplierId'),
...

@codecov-commenter
Copy link

codecov-commenter commented May 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.76%. Comparing base (4872cc7) to head (9ede84a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1860   +/-   ##
=======================================
  Coverage   99.76%   99.76%           
=======================================
  Files          88       88           
  Lines        6032     6032           
  Branches      512      512           
=======================================
  Hits         6018     6018           
  Misses         12       12           
  Partials        2        2           

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

@CodeDredd CodeDredd changed the title fix(pinia-orm): Two same belongsToMany with inverse keys are causing wrong saved data on same model fix(pinia-orm): Two same belongsToMany with inverse keys on same model are causing wrong saved data May 24, 2024
@CodeDredd CodeDredd merged commit ed747cb into main May 24, 2024
@CodeDredd CodeDredd deleted the pinia-orm-1857 branch May 24, 2024 11:11
@github-actions github-actions bot mentioned this pull request May 17, 2024
@github-actions github-actions bot mentioned this pull request Jul 10, 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.

Relationship: Many-to-many (self relation) [Followup on issue #1447]
2 participants