Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Changes from 2 commits
dd3d66f
43235de
baa476f
d37bdb2
a067700
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 theDelegateMagicCodeModal
, we need to navigate back to theSecuritySettingsPage
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 ofshowValidateActionModal
and useDelegateMagicCodeModal
directly on theSecuritySettingsPage
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 theSecuritySettingsPage
? Wouldn’t it be easier to handle if we used theDelegateMagicCodeModal
directly on theSecuritySettingsPage
instead? Or am I missing some underlying logic here?App/src/pages/settings/Security/SecuritySettingsPage.tsx
Line 157 in 6cd5c64
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.
Can we proceed by adding
setIsValidateCodeActionModalVisible
in theonClose
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 theif (!showValidateActionModal) {
block? Since, ifshowValidateActionModal
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
Check failure on line 1 in src/pages/settings/Security/AddDelegate/DelegateMagicCodeModal.tsx
GitHub Actions / Changed files ESLint check
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 thesetIsValidateCodeActionModalVisible
? By pressing onClose, we can handle thesetIsValidateCodeActionModalVisible
on theConfirmDelegatePage
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 ⬆️