-
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 "New messages" banner shows up every time sending a message in a chat #44724
Fix "New messages" banner shows up every time sending a message in a chat #44724
Conversation
@shubham1206agra Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Note: If you can't send a message in mWeb, disable the strict mode |
@bernhardoj Please fix tests. |
Still investigating |
Fixed the unit test. Reassure left. I will explain the fix after everything is fixed. |
@@ -186,7 +186,7 @@ function PopoverMenu({ | |||
if (menuItems.length === 0) { | |||
return; | |||
} | |||
setEnteredSubMenuIndexes([]); | |||
setEnteredSubMenuIndexes(CONST.EMPTY_ARRAY); | |||
setCurrentMenuItems(menuItems); | |||
}, [menuItems]); |
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.
This fixes the reassure extra render count. This effect is run on mount and on menuItems
prop update. enteredSubMenuIndexes
initial value is []
and we update it to []
which has different references. Using CONST.EMPTY_ARRAY
so it has stable references.
Navigation.setParams({referrer: undefined}); | ||
if (isFromNotification) { | ||
Navigation.setParams({referrer: undefined}); | ||
} |
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.
This also fixes the test of UnreadIndicatorsTest. When the test runner opens the report screen, if it's unread (which is true), it will call both functions above to mark the report as read and remove the referrer
param.
When the referrer param is updated, the report screen is re-mounted (on test only), but the readNewestAction optimisticData isn't completed yet and triggers the above logic again, repeatedly, infinitely.
This doesn't happen when we still use withOnyx, specifically the reportMetadata
. Using withOnyx
, when the report screen is re-mounted, it's not immediately rendered because reportMetadata
has a pending merge, giving optimisticData
of readNewestAction
time to complete.
I think the best solution is to clear the referrer
param after the readNewestAction
optimisticData
is applied, but I'm not sure how we can do that without using a timeout.
Given the re-mount behavior when updating param is only occurs on test, I updated the code to only clears it when referrer
exists.
We still have 1 issue left.
Based on the crash log and react docs, this is because we keep returning a different value from I think this happen after Expensify/react-native-onyx#551 where we do App/src/pages/home/ReportScreen.tsx Line 829 in a84f68e
cc: @fabioh8010 |
@bernhardoj Thanks for the info, I'm going to take a look at Onyx! |
@bernhardoj Here's the Onyx Draft PR. I will add tests tomorrow and open it for review. |
@fabioh8010 thanks! I tested it locally in this PR and it solves the issue. |
@bernhardoj I opened the Onyx PR to review. |
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪
|
bump @shubham1206agra |
@bernhardoj Can you merge the main once again please? |
Merged with main |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeScreen.Recording.2024-07-16.at.11.41.04.PM.moviOS: NativeScreen.Recording.2024-07-16.at.11.56.24.PM.moviOS: mWeb SafariScreen.Recording.2024-07-16.at.11.34.51.PM.movMacOS: Chrome / SafariScreen.Recording.2024-07-16.at.11.15.37.PM.movMacOS: DesktopScreen.Recording.2024-07-16.at.11.44.53.PM.mov |
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.
LGTM and tested well in my account!
✋ 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/youssef-lr in version: 9.0.8-1 🚀
|
🚀 Cherry-picked to staging by https://github.com/Beamanator in version: 9.0.8-3 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
[CP Staging] Revert "Merge pull request #44724 from bernhardoj/fix/43486-new-messge-shows-every-time-add-new-message
🚀 Deployed to production by https://github.com/mountiny in version: 9.0.8-6 🚀
|
🚀 Deployed to staging by https://github.com/youssef-lr in version: 9.0.9-1 🚀
|
…x/43486-new-message-shows-every-time-add-new-message"" This reverts commit 0a3604a.
🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.0.9-2 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/mountiny in version: 9.0.10-7 🚀
|
Details
Sending a message in a chat always shows the "New message" floating banner. This PR fix it.
Fixed Issues
$ #43486
PROPOSAL: #43486 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
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
android.mp4
Android: mWeb Chrome
android.mweb.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4