-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 empty chat displayed in focus mode #40336
Conversation
const report2 = LHNTestUtils.getFakeReport([3, 4], 2, true); | ||
const report3 = LHNTestUtils.getFakeReport([5, 6], 1, true); | ||
const report4 = LHNTestUtils.getFakeReport([7, 8], 0, true); | ||
const report1 = {...LHNTestUtils.getFakeReport([1, 2], 3, true), lastMessageText: 'test'}; |
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.
Add lastMessageText
to getFakeReport
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.
Actually let's not block on this. I see getFakeReport
used in many places where we just extend its response
Reviewer Checklist
Screenshots/Videos |
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.
Looks good but can we do this too?
I'm not sure why we named this like that, but seeing as it's called "focus" mode through the stack, let's name this to isInFocusMode
@flodnv Apologies, I'm not entirely clear on your meaning:
Please indicate where it's referenced as "focus" mode by commenting on the code. Thanks |
src/libs/ReportUtils.ts
Outdated
@@ -4616,11 +4616,23 @@ function buildOptimisticMoneyRequestEntities( | |||
return [createdActionForChat, createdActionForIOUReport, iouAction, transactionThread, createdActionForTransactionThread]; | |||
} | |||
|
|||
// Check if the report is empty report |
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.
We should use comments to be descriptive and explain why or how the code is doing so and so, instead of using comments to repeat what the code is already saying.
So here, we can say something like:
// Check if the report is empty, meaning it has no visible messages (i.e. only a "created" report action).
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.
I updated comment
It looks like this PR may have broken |
I am investigating the |
Any update on this? |
I am still investigating how to pass the perf test. @s77rt. Do you have any suggestions? |
@tienifr In the const report = {...LHNTestUtils.getFakeReport(participants, 1, true), lastMessageText: 'hey'}; |
Setting myself a reminder to merge on Monday - https://expensify.slack.com/archives/C01GTK53T8Q/p1715105636003919 |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/flodnv in version: 1.4.73-0 🚀
|
This PR is failing because of issue #42070 330089805-c1565812-33b6-4347-af2a-53d104cba0cb.mp4 |
🚀 Deployed to production by https://github.com/Beamanator in version: 1.4.73-7 🚀
|
if (!report) { | ||
return true; | ||
} | ||
const lastVisibleMessage = ReportActionsUtils.getLastVisibleMessage(report.reportID); |
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.
Coming from this bug #43994, we should have used ReportUtils.getLastVisibleMessage
instead of ReportActionsUtils.getLastVisibleMessage
to avoid such a bug, more context in #43994 (comment)
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 two functions? We should merge into one. Looking at the function names alone you can't tell which one to use
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.
The only difference is that when a message is deleted:
ReportUtils.getLastVisibleMessage
will return[Deleted message]
;ReportActionsUtils.getLastVisibleMessage
will return an empty string''
;
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.
Hm, I agree this is error prone and will tend to lead to more bugs.
Details
Fixed Issues
$ #38368
PROPOSAL: #38368 (comment)
Tests
(You)
at the end.Offline tests
QA Steps
(You)
at the end.PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Screen.Recording.2024-04-17.at.15.34.25.mov
Android: mWeb Chrome
Screen.Recording.2024-04-17.at.15.32.50.mov
iOS: Native
Screen.Recording.2024-04-17.at.15.29.27.mov
iOS: mWeb Safari
Screen.Recording.2024-04-17.at.15.27.22.mov
MacOS: Chrome / Safari
Screen.Recording.2024-04-17.at.15.09.26.mov
MacOS: Desktop
Screen.Recording.2024-04-17.at.15.23.41.mov