-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix conversation grouping null crash #3766
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
Conversation
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.
Code Review
This pull request addresses a critical bug where incorrect conversation details could be displayed due to improper handling of null returns from getConversationDateAndIndex. The review includes suggestions to ensure robust state management within the conversation_provider.dart method, aligning with the principle that provider methods should handle state management to prevent UI-level data inconsistencies. This ensures the detail page always displays the correct conversation, preventing potential data corruption or user confusion.
| // Ensure the provider has the conversation data from the widget parameter | ||
| provider.setCachedConversation(widget.conversation); | ||
|
|
||
| conversationProvider.groupConversationsByDate(); |
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.
why do we have to group them here?
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.
so that grouped state exists before both index lookup and updates, preventing wrong indexing and null crash
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.
@mdmohsin7 man don't hesitate with @krushnarout and feel free to merge the PR once you see it's good.
|
@mdmohsin7 fixed conflicts, pls review thank you |
closes #3764