Skip to content

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

Open
wants to merge 7 commits into
base: feature/thread-master-0.16.0
Choose a base branch
from

Conversation

tddang-linagora
Copy link
Collaborator

Issue

Demo

Screen.Recording.2025-06-20.at.10.07.38.mov

Copy link

This PR has been deployed to https://linagora.github.io/tmail-flutter/3813.

@tddang-linagora tddang-linagora requested a review from dab246 June 20, 2025 07:30
@tddang-linagora tddang-linagora linked an issue Jun 23, 2025 that may be closed by this pull request
1 task
@dab246 dab246 force-pushed the feature/thread-master-rebased branch from 1a46574 to 9aecebb Compare June 26, 2025 04:44
@tddang-linagora tddang-linagora changed the base branch from feature/thread-master-rebased to feature/thread-master-0.16.0 June 26, 2025 04:53
Comment on lines 13 to 14
if (!isThreadDetailEnabled &&
selectedEmailId != null &&
Copy link
Member

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 21 to 26
consumeState(Stream.value(Right(GetThreadByIdSuccess([
selectedEmail!.id!,
]))));
consumeState(Stream.value(Right(GetEmailsByIdsSuccess([
selectedEmail,
]))));
Copy link
Collaborator Author

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.

Comment on lines 21 to 23
consumeState(Stream.value(Right(GetThreadByIdSuccess([
selectedEmail!.id!,
]))));
Copy link
Member

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

Copy link
Member

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

Suggested change
consumeState(Stream.value(Right(GetThreadByIdSuccess([
selectedEmail!.id!,
]))));
_triggerGetDetailsSelectedEmail();
void _triggerGetDetailsSelectedEmail() { 
  consumeState(Stream.fromIterable([
    Right(GetThreadByIdSuccess([selectedEmail!.id!])),
    Right(GetEmailsByIdsSuccess([selectedEmail])),
  ]));
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 21 to 24
consumeState(Stream.fromIterable([
Right(PreloadEmailIdsInThreadSuccess([selectedEmail!.id!])),
Right(PreloadEmailsByIdsSuccess([selectedEmail])),
]));
Copy link
Member

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

Copy link
Collaborator Author

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separate it in method

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 45 to 46
if (emailIdsPresentation.length == 1 &&
emailIdsPresentation.keys.contains(selectedEmailId)) return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separate function

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

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);

Copy link
Collaborator Author

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 '
Copy link
Member

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@tddang-linagora tddang-linagora requested a review from hoangdat June 27, 2025 02:38
Comment on lines 59 to 62
bool _currentThreadOnlyContainsSelectedEmail(EmailId? selectedEmailId) {
return emailIdsPresentation.length == 1 &&
emailIdsPresentation.keys.contains(selectedEmailId);
}
Copy link
Member

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

Copy link
Collaborator Author

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.

Copy link
Member

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)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@dab246
Copy link
Member

dab246 commented Jun 27, 2025

  • Email feels like it's flashing when opening, how to fix it?
Screen.Recording.2025-06-27.at.10.56.54.mov

@dab246
Copy link
Member

dab246 commented Jun 27, 2025

  • Email subject is duplicated & email is not opened when quick select multiple times, multiple emails on tablet
Screen.Recording.2025-06-27.at.11.08.01.mov

@tddang-linagora
Copy link
Collaborator Author

Email feels like it's flashing when opening, how to fix it?

Only way to fix it is making either Thread/get or Email/get full detail wait for the other, which defeats the purpose of this PR.

@hoangdat
Copy link
Member

Only way to fix it is making either Thread/get or Email/get full detail wait for the other, which defeats the purpose of this PR.

IMO, no problem if waiting Email/get complete, then call Thread/get? WDYT?

@tddang-linagora
Copy link
Collaborator Author

IMO, no problem if waiting Email/get complete, then call Thread/get? WDYT?

Screen.Recording.2025-06-27.at.15.09.38.mov

Email subject is duplicated & email is not opened when quick select multiple times, multiple emails on tablet

Screen.Recording.2025-06-27.at.15.09.16.mov

@tddang-linagora tddang-linagora requested a review from dab246 June 27, 2025 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Thread Detail] Optimize content loading
3 participants