-
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
Move visible state to parent component #51350
Move visible state to parent component #51350
Conversation
@jayeshmangwani 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] |
2f66068
to
baa476f
Compare
onClose?: () => void; | ||
}; | ||
|
||
function DelegateMagicCodeModal({login, role, onClose}: DelegateMagicCodeModalProps) { | ||
function DelegateMagicCodeModal({login, role, onClose, isValidateCodeActionModalVisible, setIsValidateCodeActionModalVisible}: DelegateMagicCodeModalProps) { |
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.
Can we use a single onClose
prop here, and not pass the setIsValidateCodeActionModalVisible
? By pressing onClose, we can handle the setIsValidateCodeActionModalVisible
on the ConfirmDelegatePage
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.
@cretadn22 ⬆️
@cretadn22 please check this comment |
@jayeshmangwani This suggestion has a small issue, please give me some time to thoroughly test it. I'll provide an update shortly. |
@cretadn22 Could you please elaborate on the specific issue? If we get more details, we can work on figuring it out together. |
bump @cretadn22 |
if (!showValidateActionModal) { | ||
return; | ||
} | ||
Navigation.navigate(ROUTES.SETTINGS_SECURITY); |
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.
@jayeshmangwani I'm not clear on why this code is necessary. Which use case is it addressing?
cc @getusha
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.
@cretadn22 It seems this case was added to handle navigation depending on the source page. If we arrive from the SecuritySettingsPage
and close the DelegateMagicCodeModal
, we need to navigate back to the SecuritySettingsPage
on close. However, if we come from the Add Copilot flow, we should simply hide the modal without further navigation.
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.
After reviewing the git blame
and testing the flow, I believe a bit of refactoring is needed here. For example, we can remove the entire usage of showValidateActionModal
and use DelegateMagicCodeModal
directly on the SecuritySettingsPage
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.
@getusha Could you help us understand why we navigate to the DelegateConfirmPage
from the SecuritySettingsPage
? Wouldn’t it be easier to handle if we used the DelegateMagicCodeModal
directly on the SecuritySettingsPage
instead? Or am I missing some underlying logic here?
Navigation.navigate(ROUTES.SETTINGS_DELEGATE_CONFIRM.getRoute(email, role, 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.
@cretadn22, I've pinged Getabalew on Slack to see why the above was added and what it does. Let's see if they can help us understand.
cc: @carlosmiceli
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.
If so, I believe the current code is both safer and simpler.
Can we proceed by adding setIsValidateCodeActionModalVisible
in the onClose
function?
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 did that
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.
Oh, sorry, I missed your commit. Have you tested all the platforms again after this change?
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.
One question: can we add setIsValidateCodeActionModalVisible(false);
inside the if (!showValidateActionModal) {
block? Since, if showValidateActionModal
is true, we’re already calling the navigation.navigate, so when we return to this page, isValidateCodeActionModalVisible
will be set to 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.
@jayeshmangwani I made updates and tests, it is fine
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid.mp4Android: mWeb Chromemweb-chrome.mp4iOS: Nativeios.moviOS: mWeb Safarimweb-safari.movMacOS: Chrome / Safariweb.movMacOS: Desktopdesktop.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 🚀
✋ 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/carlosmiceli in version: 9.0.57-0 🚀
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.0.57-10 🚀
|
Details
Fixed Issues
$ #51273
PROPOSAL: #51273 (comment)
Tests
QA Steps
Offline tests
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
Screen.Recording.2024-10-24.at.00.25.13.mov
Android: mWeb Chrome
Screen.Recording.2024-10-24.at.00.01.35.mov
iOS: Native
Screen.Recording.2024-10-24.at.00.23.28.mov
iOS: mWeb Safari
Screen.Recording.2024-10-24.at.00.01.11.mov
MacOS: Chrome / Safari
Screen.Recording.2024-10-23.at.23.57.20.mov
MacOS: Desktop
Screen.Recording.2024-10-23.at.23.59.22.mov