-
Notifications
You must be signed in to change notification settings - Fork 16
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 data crash with inverse attribute #519
fix: core data crash with inverse attribute #519
Conversation
@IvanStepanok will review this, because deletionRule=“Cascade” was done intentionally to fix a different crash case. |
Hi @rnr, great that you hit on this topic. This problem sometimes haunts the project and I think I have found a solution. We used cascading deletion of the database so that no garbage is left behind when deleting, but we didn't take into account that we need to clearly define the relationships between the database objects. I set up the relationships and it works great! Now when I delete a database due to a conflict, the application does not crash. To test it, I tried to write a function that I run right at the start of the application when creating a context:
There is screenshots with all relationships settings. You can try it: I hope this solution will fix this crash🙏 |
Thank you @IvanStepanok ! |
hi @IvanStepanok, yes main point is to add relationship between Can you provide example what crash fixed by |
Hi @forgotvas We added a cascading deletion rule to fix an issue where reloading CDPrimaryCourse did not overwrite nested objects properly. By using "Cascade," related entities (like CDAssignment) are now deleted alongside their parent, ensuring that when reloading, new data can be saved without conflicts from residual old data. |
do you have steps to reproduce that crash, want to try to repeat it in my branch with my fix. |
As I remember, you need a really large course to reproduce this error. On the first attempt, caching works fine, but on the second time, there's a cascade of core data errors. Nothing special, the app still works, but the cache is not updated. |
So @IvanStepanok @forgotvas |
Please resolve git conflicts |
Conflict is resolved |
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
This PR fixes crash: