-
Notifications
You must be signed in to change notification settings - Fork 210
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
Convert to models after NSFetchedResultsController finishes reporting changes #3508
Conversation
SDK Size
|
SDK Performance
|
07eae5b
to
629460a
Compare
… changes for avoiding update cycle triggered by fetch requests in item creator
629460a
to
a1bc59e
Compare
SDK Size
|
Quality Gate passedIssues Measures |
// Model conversion is safe when all the changes have been processed (Core Data's _processRecentChanges can be called if conversion triggers additional fetch requests). | ||
let itemChanges = currentChanges.compactMap { dtoChange in |
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.
This makes sense. Does this potentially fix the current workaround we have with the depth
stuff?
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.
Unfortunately no because the circular cycle can still occur with MessageDTO's replies contains a quoted message.
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.
Nice find 👌
I've QA it myself, it seems to work fine 👍 At least I was not able to reproduce the crash anymore. |
🔗 Issue Links
Resolves IOS-569
🎯 Goal
Fix a crash caused by infinite loop in Core Data when converting models
📝 Summary
NSFetchedRequestController
has finished reporting changes🛠 Implementation
We had an internal crash report which showed that Core Data change came in, triggered
NSFetchedRequestController
delegate, then we converted the DTO to a model type, but since the model type did another fetch request, this triggered the whole cycle again. Therefore, let's avoid it by delaying the model conversion to the point of time whereNSFetchedRequestController
has finished reporting changes.🧪 Manual Testing Notes
Retrying the flow in IOS-569 which triggered it.
☑️ Contributor Checklist