-
Notifications
You must be signed in to change notification settings - Fork 3k
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 bug in global modal state management during unmounting #19744
Fix bug in global modal state management during unmounting #19744
Conversation
@hayata-suenaga @eVoloshchak One of you needs to 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] |
This comment was marked as outdated.
This comment was marked as outdated.
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-05-31.at.14.27.33.movMobile Web - ChromeScreen.Recording.2023-05-31.at.13.41.34.movMobile Web - SafariScreen.Recording.2023-05-31.at.13.34.16.movDesktopScreen.Recording.2023-05-31.at.14.30.30.moviOSScreen.Recording.2023-05-31.at.13.36.26.movAndroidScreen.Recording.2023-05-31.at.13.39.15.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.
@kidroca, this tests well and the bug is resolved, but the carousel for User A ends up still containing the attachment after you delete it from User B's account
Screen.Recording.2023-05-30.at.16.47.41.mov
Is this in the scope of this PR?
This is the expected behavior. The attachment will disappear the next time the carousel is opened
|
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.
Tests well
Previously, unmounting any modal, even if it was not visible, would trigger a change in the global modal visibility state. This could lead to situations where the global state inaccurately reflected that no modals were visible, even when one was. This commit fixes this issue by changing the unmounting logic: now, the global state is only updated if the modal being unmounted was visible. This ensures an accurate global modal visibility state at all times.
c3bd044
to
1e99974
Compare
componentWillUnmount() { | ||
// we don't want to call the onModalHide on unmount | ||
this.hideModal(this.props.isVisible); | ||
|
||
// Only trigger onClose and setModalVisibility if the modal is unmounting while visible. | ||
if (this.props.isVisible) { | ||
this.hideModal(true); |
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.
There's concern about this solution.
cc: @parasharrajat
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.
Concern resolved.
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
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Cherry-picked to staging by https://github.com/hayata-suenaga in version: 1.3.24-5 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/roryabraham in version: 1.3.24-5 🚀
|
🚀 Deployed to production by https://github.com/roryabraham in version: 1.3.24-5 🚀
|
Details
The problem originates from a specific issue regarding the management of modal visibility state within our application. When a thumbnail image in the chat screen, which also renders an
AttachmentModal
, gets removed, it leads to an unintended chain of events:AttachmentModal
.For more in-depth details, please refer to the linked issue and comment
Fixed Issues
$ #18150
PROPOSAL: #18150 (comment)
Tests
Test 1: Bug Fix Verification
Objective: Confirm the previously reported bug is resolved
Note: The following steps provide the most reliable way to reproduce the original bug, though it could also occur under other conditions, such as virtualization removing a comment with an attachment from the virtual window.
Procedure:
Expected Outcome:
Notes:
Offline tests
N/A
QA Steps
Test 1: Bug Fix Verification
Objective: Confirm the previously reported bug is resolved
Note: The following steps provide the most reliable way to reproduce the original bug, though it could also occur under other conditions, such as virtualization removing a comment with an attachment from the virtual window.
Procedure:
Expected Outcome:
Notes:
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
Web
iOS.Web.mov
Mobile Web - Chrome
Android.Emulator.-.Pixel_4_API_31_5554.2023-05-30.12-22-33.mp4
Mobile Web - Safari
mobile.Safari.Web.mov
Desktop
Desktop.iOS.mov
iOS
iOS.Web.mov
Android
Android.Emulator.-.Pixel_4_API_31_5554.2023-05-30.12-21-11.mp4