Skip to content
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

Fix optimistic message created while offline is marked as unread #56628

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/pages/home/report/ReportActionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ function ReportActionsList({
*/
const wasMessageReceivedWhileOffline = useCallback(
(message: OnyxTypes.ReportAction) =>
!wasActionTakenByCurrentUser(message) && wasActionCreatedWhileOffline(message, isOffline, lastOfflineAt.current, lastOnlineAt.current, preferredLocale),
!wasActionTakenByCurrentUser(message) &&
wasActionCreatedWhileOffline(message, isOffline, lastOfflineAt.current, lastOnlineAt.current, preferredLocale) &&
!(message.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD || message.isOptimisticAction),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I proceed with a different approach because I feel like having the isOffline condition in wasActionCreatedWhileOffline makes sense with the function name. So, I updated wasMessageReceivedWhileOffline instead because if it's an optimistic action, then it's a message that we send, not receive.

[isOffline, lastOfflineAt, lastOnlineAt, preferredLocale],
);

Expand Down
Loading
Loading