-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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: incorrect page is displayed when refreshing the page #54680
Conversation
@allgandalf 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] |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2025-02-24.at.5.50.18.PM.movAndroid: mWeb ChromeScreen.Recording.2025-02-24.at.5.48.49.PM.moviOS: NativeScreen.Recording.2025-01-31.at.12.39.26.PM.moviOS: mWeb SafariScreen.Recording.2025-01-31.at.12.40.22.PM.movMacOS: Chrome / SafariScreen.Recording.2025-01-31.at.12.36.23.PM.movMacOS: DesktopScreen.Recording.2025-01-31.at.12.37.02.PM.mov |
@truph01 , we are still getting navigated to previous page and then we come on the code page, which prompts to multiple magic codes, can you please check? |
Sorry, can you give me the detailed reproduction steps for this issue? |
just follow the steps you wrote , you can see that we still see the previous page for a split second. please check the expected result from the issue:
Note that the user gets redirected to the code page, here the expected result is that we should not get redirected Screen.Recording.2025-01-09.at.11.07.42.AM.mov |
@allgandalf I updated PR to address issue |
@@ -1,4 +1,4 @@ | |||
import React, {useState} from 'react'; |
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.
@truph01 for my understanding, can you explain why that regression occured and how did we fix it?
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.
asking cause I'm not a fan of introducing new props unless there is no other option
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 you explain why that regression occured and how did we fix it?
The modal defined in:
<DelegateMagicCodeModal |
utilizes animation for sliding in and out. Consequently, even if we consistently set the isValidateCodeActionModalVisible
value to true
in:
isValidateCodeActionModalVisible={isValidateCodeActionModalVisible} |
the modal doesn’t appear instantly. Instead, its container remains visible momentarily due to the animation transition.
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.
makes sense to me, thanks a lot
@@ -80,6 +87,8 @@ function ConfirmDelegatePage({route}: ConfirmDelegatePageProps) { | |||
shouldShowRightIcon | |||
/> | |||
<DelegateMagicCodeModal | |||
// eslint-disable-next-line react-compiler/react-compiler |
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.
why do we need to disable this one ?
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 not, we will encounter the lint error: Ref values (the current
property) may not be accessed during render
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.
yeah i mean 😅 , we shouldn't disable the error unless it's absolutely necessary, can you work through it?
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 couldn't find a way to fix the ESLint issue without disabling the lint rule. However, we are using similar logic in many places throughout the app, such as:
/* eslint-disable react-compiler/react-compiler */ |
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 you ask on open source channel, i'm not really sure about this update
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 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.
@allgandalf I just updated PR. Now I use state instead of ref.
@allgandalf Could you review PR once you have a chance? Thanks. |
@@ -70,6 +71,7 @@ function ValidateCodeActionModal({ | |||
hideModalContentWhileAnimating | |||
useNativeDriver | |||
shouldUseModalPaddingStyle={false} | |||
animationInTiming={disableAnimation ? 1 : 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.
@truph01 can you please put a comment here explaining why this is needed ? the git blame will not explain to others why we needed 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.
I just added comment
// If `disableAnimation` is true, set `animationInTiming` to 1 to disable the animation effect | ||
animationInTiming={disableAnimation ? 1 : 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.
let me rephrase 😅 , I meant that we need explanation for this change and not what this expression does
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 believe the comment 'set animationInTiming to 1 to disable the animation effect' already clarifies the change. Do you have any suggestions for it?
Just so you know, the line animationInTiming={disableAnimation ? 1 : undefined}
is already in use in our app without any comment.
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 believe the comment 'set animationInTiming to 1 to disable the animation effect' already clarifies the change. Do you have any suggestions for it?
It's not about the change but more of the functionality, In the checklist we have:
I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
Just so you know, the line animationInTiming={disableAnimation ? 1 : undefined} is already in use in our app without any comment.
There should had been a comment explaning it, i will raise this one internally but in the meantime please explain why
we needed to make the 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.
Are you suggesting that we add a comment explaining why this change fixes the issue? If so, I think it would be better to add the comment to this line:
The comment could be:
'We should disable the animation initially and only enable it when the user manually opens the modal to ensure it appears immediately when refreshing the page.'
About the animationInTiming={disableAnimation ? 1 : undefined}
, we can discuss internally adding the comment since this line has also been used in other places in the past.
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.
works for me!
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 updated it
// We should disable the animation initially and only enable it when the user manually opens the modal | ||
// to ensure it appears immediately when refreshing the page. | ||
disableAnimation={shouldDisableModalAnimation} |
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.
makes a lot of sense to anyone reading this in the future, thanks for this ❤️
@truph01 the PR still shows the previous page for a second for small screen refresh: Screen.Recording.2025-01-31.at.12.43.05.PM.mov |
The previous page briefly appears as mentioned in here because our modal isn't displayed immediately when visible is set to true. I plan to show a loading indicator instead of the previous screen until the modal fully appears. You can see the result of that plan in the video below: Screen.Recording.2025-02-01.at.01.36.34.movcc @Expensify/design Would love to hear your thoughts—thanks! |
@Expensify/design Could you please help take a look once you have a chance, thanks. |
bump @Expensify/design |
1 similar comment
This comment was marked as duplicate.
This comment was marked as duplicate.
Sorry, totally missed this one!
That makes sense to me and sounds like a good solution - let's go with it and see how it feels. |
I updated PR to align with this solution and here is result: Screen.Recording.2025-02-19.at.18.49.18.mov |
Yes, it is because the loading indicator has a transparent background |
Cool - if we really want to be perfect about this, I would pass through an extraClass to make it so that the BG doesn't have transparency, but I don't feel strongly. |
@shawnborton As you said above, "That being said, this is not a common case so I don't think we need to bang our heads over a perfect solution here.", I believe the loading indicator with a transparent background is sufficient, as it’s not a frequent scenario, and even when it occurs, the loading screen is only displayed briefly. |
Fair! |
✋ 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.1.5-0 🚀
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 9.1.5-5 🚀
|
Explanation of Change
Fixed Issues
$ #54021
PROPOSAL: #54021 (comment)
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)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-12-31.at.16.32.23.mov
Android: mWeb Chrome
Screen.Recording.2024-12-31.at.16.31.06.mov
iOS: Native
Screen.Recording.2024-12-31.at.16.35.21.mov
iOS: mWeb Safari
Screen.Recording.2024-12-31.at.16.34.13.mov
MacOS: Chrome / Safari
Screen.Recording.2024-12-31.at.16.29.38.mov
MacOS: Desktop
Screen.Recording.2024-12-31.at.16.38.51.mov