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 |
* fix: core data crash with inverse attribute (openedx#69) * chore: set deletetionRule as Cascade --------- Co-authored-by: Vadim Kuznetsov <vadim@touchappmedia.com> Co-authored-by: Anton Yarmolenko <37253+rnr@users.noreply.github.com>




This PR fixes crash: