-
Notifications
You must be signed in to change notification settings - Fork 88
TF-3804 Thread Detail Load selected email in parallel #3813
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
base: feature/thread-master-0.16.0
Are you sure you want to change the base?
TF-3804 Thread Detail Load selected email in parallel #3813
Conversation
This PR has been deployed to https://linagora.github.io/tmail-flutter/3813. |
...features/thread_detail/presentation/extension/handle_get_email_ids_by_thread_id_success.dart
Outdated
Show resolved
Hide resolved
...features/thread_detail/presentation/extension/handle_get_email_ids_by_thread_id_success.dart
Outdated
Show resolved
Hide resolved
...features/thread_detail/presentation/extension/handle_get_email_ids_by_thread_id_success.dart
Outdated
Show resolved
Hide resolved
lib/features/thread_detail/presentation/extension/thread_detail_on_selected_email_updated.dart
Outdated
Show resolved
Hide resolved
1a46574
to
9aecebb
Compare
if (!isThreadDetailEnabled && | ||
selectedEmailId != null && |
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.
should be in a method
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.
Done
consumeState(Stream.value(Right(GetThreadByIdSuccess([ | ||
selectedEmail!.id!, | ||
])))); | ||
consumeState(Stream.value(Right(GetEmailsByIdsSuccess([ | ||
selectedEmail, | ||
])))); |
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.
To follow the original flow of logic of thread.
consumeState(Stream.value(Right(GetThreadByIdSuccess([ | ||
selectedEmail!.id!, | ||
])))); |
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.
IMO, call this here aren't make sense. It means get thread succeed it then still call it again
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.
should separate it to a method
consumeState(Stream.value(Right(GetThreadByIdSuccess([ | |
selectedEmail!.id!, | |
])))); | |
_triggerGetDetailsSelectedEmail(); |
void _triggerGetDetailsSelectedEmail() {
consumeState(Stream.fromIterable([
Right(GetThreadByIdSuccess([selectedEmail!.id!])),
Right(GetEmailsByIdsSuccess([selectedEmail])),
]));
}
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.
Done
consumeState(Stream.fromIterable([ | ||
Right(PreloadEmailIdsInThreadSuccess([selectedEmail!.id!])), | ||
Right(PreloadEmailsByIdsSuccess([selectedEmail])), | ||
])); |
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.
Should be in a separate method
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.
Done
@@ -38,7 +38,7 @@ extension HandleGetEmailsByIdsSuccess on ThreadDetailController { | |||
); | |||
} | |||
|
|||
if (!isLoadMore) return; | |||
if (!isLoadMore || emailIdsPresentation.length == 1) return; |
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.
separate it in method
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.
Done
if (emailIdsPresentation.length == 1 && | ||
emailIdsPresentation.keys.contains(selectedEmailId)) return; |
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.
separate function
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.
Done
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.
should add test for failed case handleGetThreadByIdFailure(failure);
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.
Done
|
||
test( | ||
'should not reset thread detail controller ' | ||
'and consume GetThreadByIdSuccess and GetEmailsByIdsSuccess ' |
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.
should update state for these
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.
Done
bool _currentThreadOnlyContainsSelectedEmail(EmailId? selectedEmailId) { | ||
return emailIdsPresentation.length == 1 && | ||
emailIdsPresentation.keys.contains(selectedEmailId); | ||
} |
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.
selectedEmailId should be is non-null
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.
emailIdsPresentation
is Map<EmailId, PresentationEmail?>
, so keys
is already List<EmailId>
. So if List<EmailId>
contains selectedEmailId
, by natural selectedEmailId
is non-null.
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 is the passed parameter nullable ((EmailId? selectedEmailId) . If it is null we should not check the condition emailIdsPresentation.keys.contains(selectedEmailId)
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.
Done
Screen.Recording.2025-06-27.at.10.56.54.mov |
Screen.Recording.2025-06-27.at.11.08.01.mov |
Only way to fix it is making either |
IMO, no problem if waiting Email/get complete, then call Thread/get? WDYT? |
Screen.Recording.2025-06-27.at.15.09.38.mov
Screen.Recording.2025-06-27.at.15.09.16.mov |
Issue
Demo
Screen.Recording.2025-06-20.at.10.07.38.mov