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(core): propagation with nullable 1:1 relation #3851

Merged
merged 4 commits into from
Dec 16, 2022

Conversation

alisd23
Copy link
Contributor

@alisd23 alisd23 commented Dec 15, 2022

Fixes #3850

I'm not very familar with the code, so I'm not confident with the solution, but I think this is what is needed.

Tests added and related tests for #3614 also still pass

Copy link
Member

@B4nan B4nan left a comment

Choose a reason for hiding this comment

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

Amazing, thank you! I just briefly checked the repros but didn't have time to actually look into it just yet. The change looks fine to me, so as long as the test suite is passing, we are good to merge.

packages/core/src/unit-of-work/UnitOfWork.ts Outdated Show resolved Hide resolved
@alisd23
Copy link
Contributor Author

alisd23 commented Dec 15, 2022

No worries - just give me a few hours so I can add more test cases as I'm not quite sure this is the right solution.

Let me know if you've had time to check whether you think it's right/wrong 👍

@codecov-commenter
Copy link

codecov-commenter commented Dec 15, 2022

Codecov Report

Base: 99.80% // Head: 99.80% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (8233a70) compared to base (fb996cc).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3851   +/-   ##
=======================================
  Coverage   99.80%   99.80%           
=======================================
  Files         214      214           
  Lines       13582    13586    +4     
  Branches     3166     3169    +3     
=======================================
+ Hits        13555    13559    +4     
  Misses         25       25           
  Partials        2        2           
Impacted Files Coverage Δ
packages/core/src/unit-of-work/UnitOfWork.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@alisd23
Copy link
Contributor Author

alisd23 commented Dec 15, 2022

Added a few more test cases, so now we cover:

  • Adding a new entity to the relation (either side)
  • Swapping an entity on the relation (either side)
  • Unlinking an entity - but not deleting either entity (either side)
  • Deleting an entity - (either side)

All seems to work as expected - hopefully nothing broken downstream

@alisd23
Copy link
Contributor Author

alisd23 commented Dec 16, 2022

@B4nan All comments are addressed now. I'm happier with the latest solution as I think it's more specific and makes more sense in my head. There's a hell of a lot of tests which is good, so hopefully it's not broken anything related to 1-M or M-M relations.

Feel free to squash all commits into the first when merging - thanks!

@alisd23 alisd23 force-pushed the fix/1-to-1-relation-propagation-3850 branch from f5e8c1f to 73dfbe2 Compare December 16, 2022 12:19
@B4nan B4nan changed the title Fix propagation with nullable 1-to-1 relation fix(core): propagation with nullable 1-to-1 relation Dec 16, 2022
@B4nan B4nan changed the title fix(core): propagation with nullable 1-to-1 relation fix(core): propagation with nullable 1:1 relation Dec 16, 2022
@alisd23
Copy link
Contributor Author

alisd23 commented Dec 16, 2022

All looks good now on CI 👍

Any idea when we might be able to release the fix? This is blocking the upgrade on my project unfortunately

@B4nan B4nan merged commit d77c370 into mikro-orm:master Dec 16, 2022
@B4nan
Copy link
Member

B4nan commented Dec 16, 2022

every commit to master is published to NPM as dev version, so you can try it in few minutes

i will probably do a patch release on sunday

@alisd23 alisd23 deleted the fix/1-to-1-relation-propagation-3850 branch December 16, 2022 14:52
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.

Nullable 1-to-1 entity propagation not working
3 participants