-
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: call onModalHide when the confirm modal is closed #18897
Conversation
@neil-marcellini @rushatgabhane 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] |
src/components/AttachmentModal.js
Outdated
@@ -155,6 +155,9 @@ class AttachmentModal extends PureComponent { | |||
*/ | |||
closeConfirmModal() { | |||
this.setState({isAttachmentInvalid: false}); | |||
if (_.isFunction(this.props.onModalHide)) { |
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 think we should keep this consistent with the similar check above. This prop is also guaranteed to always be passed to the component so I'm not really sure why we have these checks.
if (_.isFunction(this.props.onModalHide)) { | |
if (this.props.onModalHide) { |
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.
Done.
While we're at it, can we fix the naming of the event handler and prefix it with
|
|
@mountiny why are we CPing ? |
oh my bad it's a deploy blocker |
src/components/AttachmentModal.js
Outdated
if (this.props.onModalHide) { | ||
this.props.onModalHide(); | ||
} |
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.
Bad logic... This callback should not be called with confirmModal. This will cause issues in the future. onModalHide
is for the main Attachment preview Modal. Let's find another way of fixing this.
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.
Should we expose the onConfirm/onCancel for the ConfirmModal as props to the AttachmentModal? The AttachmentModal is responsible for displaying the ConfirmModal, and it's only ever displayed if the attachment is invalid.
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.
What if we pass a prop called onModalShow to AttachmentModal and call it on the innerModal's onModalShow. Now set the isAttachmentPreviewActive
in this callback from ReportActionCompose
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.
@parasharrajat let's discuss this deploy blocker on slack for a quick resolution
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.
What if we pass a prop called onModalShow to AttachmentModal and call it on the innerModal's onModalShow. Now set the
isAttachmentPreviewActive
in this callback fromReportActionCompose
This sounds like it could work. I'll test it out.
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.
@rushatgabhane I've implemented @parasharrajat's suggestion and it works great. Pushed up a new commit for review.
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-05-14.at.18.23.55.movDesktopScreen.Recording.2023-05-14.at.18.29.51.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.
Code LGTM.
@rushatgabhane Do you want to complete the Checklist for this regression PR? I don't mind 😄 . |
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.
@youssef-lr LGTM!
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.
Thanks everyone!
fix: call onModalHide when the confirm modal is closed (cherry picked from commit f4ca548)
…-18897 🍒 Cherry pick PR #18897 to staging 🍒
🚀 Cherry-picked to staging by https://github.com/mountiny in version: 1.3.13-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/Beamanator in version: 1.3.13-5 🚀
|
🚀 Cherry-picked to staging by https://github.com/AndrewGable in version: 1.3.28-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/AndrewGable in version: 1.3.28-5 🚀
|
Details
Properly clean up the state if there is an attempt to upload an invalid / unsupported attachment.
Fixed Issues
$ #18888
PROPOSAL: #18888 (comment)
Tests
Offline tests
N/A
QA Steps
Same as tests.
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
18888-web.mp4
Mobile Web - Chrome
Mobile Web - Safari
Desktop
18888-desktop.mp4
iOS
Android