Open lanitochka17 opened 2 weeks ago
Triggered auto assignment to @jliexpensify (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
Able to repro:
I think this is a #quality bug but it's low priority.
Changed the results to:
In ND, full screen not found page should be displayed immediately.
Not found page is only displayed on LHN for a while, then moves to full page.
Job added to Upwork: https://www.upwork.com/jobs/~021878269152575163326
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (External
)
Upwork job price has been updated to $125
@sobitneupane this kind of seems like a small/easy fix to me, but definitely LMK if this turns out to be more complex and we should bump up the price 🤷♂️
Edited by proposal-police: This proposal was edited at 2025-01-12 06:20:18 UTC.
Not found page is displayed only on LHN when deleting a workspace from OD
Currently, we are show Not found page on full page if (!prevShouldShowPolicy && !shouldShowPolicy) condition fullfill from here. When we first delete the workspace shouldShowPolicy is true. After rerender component shouldShowPolicy become false. So after sometime Not found page shows on full page.
To fix this issue we need to change this condition like below.
return (!isEmptyObject(policy) && !PolicyUtils.isPolicyAdmin(policy) && !shouldShowNonAdmin) || !shouldShowPolicy;
And also need to remove logic related to prevShouldShowPolicy https://github.com/Expensify/App/blob/main/src/pages/workspace/WorkspacePageWithSections.tsx#L155C11-L155C31
NA for bug
NA
Hi @jliexpensify,
The issue no longer persists on my local main branch (version: "9.0.84-1"). However, it is still present on staging.
main branch (version: "9.0.84-1")
https://github.com/user-attachments/assets/8f1bc56e-2439-485a-9ec9-9f1af91070bd
Staging:
https://github.com/user-attachments/assets/cdb01e9a-bf0b-4a39-abbe-592a9c7ce8d7
Issue is still reproducible in local and staging both the places.
🚨 Edited by proposal-police: This proposal was edited at 2025-01-20 07:38:59 UTC.
Not found page is only displayed on LHN for a while, then moves to full page.
shouldShowPolicy
is true
and prevShouldShowPolicy
is false
then the not found page doesn't show in WorkspaceProfilePage
.(!shouldShowPolicy && !prevShouldShowPolicy)
this condition aims to prevent the not found page appears when we delete the workspace in WorkspaceProfilePage
but it's not the correct way. We should only not show the not found page if the policy
is pending delete and prevPolicy
is not. Based on that we can update this condition to show not found page if shouldShowPolicy
is true
and policy
is pending delete and prevPolicy
is not.const shouldShowPolicy = useMemo(() => PolicyUtils.shouldShowPolicy(policy, isOffline, currentUserLogin), [policy, isOffline, currentUserLogin]);
const isPendingDelete = policy?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;
const prevIsPendingDelete = prevPolicy?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;
const shouldShow = useMemo(() => {
// If the policy object doesn't exist or contains only error data, we shouldn't display it.
if (((isEmptyObject(policy) || (Object.keys(policy).length === 1 && !isEmptyObject(policy.errors))) && isEmptyObject(policyDraft)) || shouldShowNotFoundPage) {
return true;
}
// We check shouldShowPolicy and prevShouldShowPolicy to prevent the NotFound view from showing right after we delete the workspace
return (!isEmptyObject(policy) && !PolicyUtils.isPolicyAdmin(policy) && !shouldShowNonAdmin) || (!shouldShowPolicy && (!isPendingDelete || prevIsPendingDelete));
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [policy, shouldShowNonAdmin, shouldShowPolicy, isPendingDelete, prevIsPendingDelete]);
PolicyUtils.goBackFromInvalidPolicy();
And I think we can also update the condition to show the page that was not found here with the same fix above. https://github.com/Expensify/App/blob/14663690594a436f3a8b5c82697432f9213e576f/src/pages/workspace/WorkspaceInitialPage.tsx#L347
This is a minor logic bug in the component then I think we don't need to add a test.
Optional: if we want a test, we can create a util for shouldShow
in WorkspacePageWithSections
and add some test cases for this function.
For point 2, we can update the logic here to call the navigate if the policy is pending delete.
useEffect(() => {
if (isEmptyObject(prevPolicy) || !PolicyUtils.isPendingDeletePolicy(prevPolicy) || !PolicyUtils.isPendingDeletePolicy(policy)) {
return;
}
console.log("back here");
PolicyUtils.goBackFromInvalidPolicy();
}, [policy, prevPolicy]);
@sobitneupane, @jliexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
Bumping @sobitneupane for reviews
return ... || (!shouldShowPolicy && (!isPendingDelete || prevIsPendingDelete));
@nkdengineer Why would we need prevIsPendingDelete
as well in the condition? Wouldn't (!shouldShowPolicy && !isPendingDelete)
be enough?
I also noticed that when I delete a workspace, Not Found Page
is displayed briefly in LHN. I believe we would not want that.
https://github.com/user-attachments/assets/88794abc-57e4-4bb5-9962-ec2d0d6ea630
!isPendingDelete || prevIsPendingDelete
@sobitneupane this condition to prevent the not found page display briefly when we delete the workspace in workspace profile page.
@nkdengineer I have checked by removing prevShouldShowPolicy
and delete the workspace from workspace profile. I can not see no found page
briefly. So just removing prevIsPendingDelete works fine, no need to add extra conditions.
@nkdengineer Even with the condition(!isPendingDelete || prevIsPendingDelete
), I can reproduce the issue mentioned in above comment.
@sobitneupane my proposal solve the issue I think. Are you facing any challenges in my proposal?
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@sobitneupane, @jliexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
Waiting on @sobitneupane to review
my proposal solve the issue I think. Are you facing any challenges in my proposal?
@ishakakkad Thanks for your proposal. Not Found Page is shown briefly if we go with your proposal.
@sobitneupane where are you see "Not Found Page" briefly? I have tested by deleting, I didn't see "Not Found Page" briefly.
https://github.com/user-attachments/assets/c1035878-5660-43a8-9eff-5480f5a75830
@ishakakkad You need to go to the workspace Details/Profile Page and delete it from the profile.
Thanks for the update @nkdengineer. The proposed solution will recreate the issue discussed in 2nd point in RCA in this proposal.
can remove the logic here since I can't reproduce the bug mentioned and the PR introduce this change.
@sobitneupane This is an optional, we can keep the current logic and only add the new logic in WorkspaceProfilePage.
Triggered auto assignment to @chiragsalian, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Proposal LGTM. Feel free to create the PR @nkdengineer.
📣 @nkdengineer 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻 Keep in mind: Code of Conduct | Contributing 📖
@sobitneupane The PR is ready for review.
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.84-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5441953 Email or phone of affected tester (no customers): expensify416+da2@gmail.com Issue reported by: Applause - Internal Team Component: Workspace Settings
Action Performed:
Expected Result:
In ND, full screen not found page should be displayed immediately.
Actual Result:
Not found page is only displayed on LHN for a while, then moves to full page.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/user-attachments/assets/84a323e3-49e2-4f78-bb9e-2bcb14ecb51c
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @sobitneupane