-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[CP Staging] Fix next steps loading state #62768
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
[CP Staging] Fix next steps loading state #62768
Conversation
@hoangzinh 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] |
src/components/MoneyReportHeader.tsx
Outdated
@@ -284,7 +284,7 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea | |||
const isSubmitterSameAsNextApprover = isReportOwner(moneyRequestReport) && nextApproverAccountID === moneyRequestReport?.ownerAccountID; | |||
const optimisticNextStep = isSubmitterSameAsNextApprover && policy?.preventSelfApproval ? buildOptimisticNextStepForPreventSelfApprovalsEnabled() : nextStep; | |||
|
|||
const shouldShowNextStep = isFromPaidPolicy && !isInvoiceReport && !shouldShowStatusBar; | |||
const shouldShowNextStep = isFromPaidPolicy && !isInvoiceReport && !shouldShowStatusBar && policy?.areWorkflowsEnabled; |
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.
As mentioned in Slack, I dont think this is the right fix, the report has some next steps even if the worflows are not enabled on the policy
46ba54c
to
c471722
Compare
@@ -892,7 +903,8 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea | |||
/> | |||
</View> | |||
)} | |||
{shouldShowNextStep && (optimisticNextStep?.message?.length ? <MoneyReportHeaderStatusBar nextStep={optimisticNextStep} /> : <MoneyReportHeaderStatusBarSkeleton />)} | |||
{shouldShowNextStep && !!optimisticNextStep?.message?.length && <MoneyReportHeaderStatusBar nextStep={optimisticNextStep} />} | |||
{shouldShowNextStep && !optimisticNextStep?.message?.length && !!isLoadingInitialReportActions && <MoneyReportHeaderStatusBarSkeleton />} |
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 do you think about this approach?
{shouldShowNextStep && !optimisticNextStep?.message?.length && !!isLoadingInitialReportActions && <MoneyReportHeaderStatusBarSkeleton />} | |
const [nextStep, nextStepResult] = useOnyx(`${ONYXKEYS.COLLECTION.NEXT_STEP}${moneyRequestReport?.reportID}`, {canBeMissing: true}); | |
.......................... | |
{shouldShowNextStep && !optimisticNextStep?.message?.length && isLoadingOnyxValue(nextStepResult) && <MoneyReportHeaderStatusBarSkeleton />} |
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.
In your solution, I am not sure why we use isLoadingInitialReportActions as a loading flag for nextStep data
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'm using isLoadingInitialReportActions
because that value is set to "loading" when openReport
command is running, openReport
command is also responsible for downloading the nextSteps
, so I use is as a loading indicator for nextSteps
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.
Unfortunately isLoadingOnyxValue
approach doesn't work, because when nextSteps
are not present in onyx then the isLoadingOnyxValue
returns false
and it doesn't know that it's being downloaded by openReport
@SzymczakJ Our PR also fix #62719 |
Could you include #62719 in the PR description? |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-05-26.at.16.39.58.movAndroid: mWeb ChromeScreen.Recording.2025-05-26.at.16.34.48.moviOS: HybridAppScreen.Recording.2025-05-26.at.16.35.26.moviOS: mWeb SafariScreen.Recording.2025-05-26.at.16.33.32.movMacOS: Chrome / SafariScreen.Recording.2025-05-26.at.16.27.31.movMacOS: DesktopScreen.Recording.2025-05-26.at.16.32.18.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
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.
Changes look good to me, thanks!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
…xt-steps-loading-state [CP Staging] Fix next steps loading state (cherry picked from commit a76fe90) (cherry-picked to staging by mountiny)
🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.1.51-3 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/arosiclair in version: 9.1.51-6 🚀
|
Explanation of Change
Fixed Issues
$ #62685
$ #62719
PROPOSAL:
Tests
Test steps for Next step action shows skeleton loading when workflows are disabled
Test steps for When expense is submitted offline,next step is loading,report title shows unavailable workspace
Precondition:
Offline tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectioncanBeMissing
param foruseOnyx
toggleReport
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
Android: mWeb Chrome
iOS: Native
Screen.Recording.2025-05-26.at.10.38.39.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2025-05-26.at.10.30.54.mov
MacOS: Desktop