-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[Hold for payment 2025-02-17][$250] Expense - Not here page shows up briefly when deleting the expense while it is highlighted #55251
Comments
Triggered auto assignment to @JmillsExpensify ( |
📣 @Maurishus! 📣
|
|
ProposalPlease re-state the problem that we are trying to solve in this issue.Expense - Not here page shows up briefly when deleting the expense while it is highlighted What is the root cause of that problem?when the expense is highlighted it's ID is taken from the url : App/src/pages/home/ReportScreen.tsx Line 103 in 7b9e55e
and handed to usePaginatedReportActions to get the linkedAction:App/src/pages/home/ReportScreen.tsx Line 242 in 7b9e55e
once the delete happens, and because the param is not removed immediately from the navigation, it's taken again and handed to so App/src/pages/home/ReportScreen.tsx Line 388 in 7b9e55e
and so App/src/pages/home/ReportScreen.tsx Lines 391 to 392 in 7b9e55e
and then param is cleared with this useEffect What changes do you think we should make in order to solve the problem?if action has been deleted we can keep a ref of it's ID, so don't we provide it again to
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?UI issue What alternative solutions did you explore? (Optional)if Highlighted getback to main thread before delete.
|
|
ProposalPlease re-state the problem that we are trying to solve in this issue.Not here page shows up briefly when deleting the expense while it is highlighted. What is the root cause of that problem?Here're the logics to show not found page App/src/pages/home/ReportScreen.tsx Lines 404 to 407 in 7b9e55e
And App/src/pages/home/ReportScreen.tsx Lines 391 to 392 in 7b9e55e
When users delete the linked action, So And when App/src/pages/home/ReportScreen.tsx Line 707 in 7b9e55e
we update the linkedReportActionID to empty string, so That why the not found page is shown shortly What changes do you think we should make in order to solve the problem?We should detect the linked action is removing, so don't open the not found page
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?This is the UI issue so no need for unit test. What alternative solutions did you explore? (Optional)Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job. |
@JmillsExpensify Huh... This is 4 days overdue. Who can take care of this? |
Job added to Upwork: https://www.upwork.com/jobs/~021881828763619055376 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @brunovjk ( |
I can reproduce, reviewing proposals |
Thank you all for the proposals. However, the root cause is still not very clear to me, I will come back here as soon as I have an update. |
Thank you @M00rish, I had to focus on other issue, I will be back here in a moment. |
Thanks for the proposals, the fact that "isLinkedActionDeleted stays true", right after "clearing the reportActionID parameter". I need a bit more time to investigate further. I'll come back as soon as I have something. |
@JmillsExpensify @brunovjk this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks! |
Thank you both, @M00rish and @daledah, for your well-thought-out proposals! 🙌 After careful consideration, I’ve chosen @daledah’s proposal. It provides a clear and focused mechanism (isResettingLinkedAction) to handle the transitional state and aligns well with the current component's logic. While @M00rish’s approach was solid, @daledah’s solution is more streamlined and avoids reliance on external state tracking. @daledah, could you create unit tests to cover this scenario? If that’s not feasible, we’ll focus on defining detailed steps for manual testing to catch any regressions. This change might impact other flows, so we’ll monitor for unintended side effects closely. Thanks again for your contributions! 🎀👀🎀 C+ reviewed |
Triggered auto assignment to @roryabraham, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Thanks for both proposals. However, these variable names have become quite confusing. I think we should take a step back and see if we can clean this up. It seems like diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx
index 7b29bef35a5..8a5db3d7191 100644
--- a/src/pages/home/ReportScreen.tsx
+++ b/src/pages/home/ReportScreen.tsx
@@ -386,7 +386,12 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
() => !!linkedAction && !shouldReportActionBeVisible(linkedAction, linkedAction.reportActionID, canUserPerformWriteAction(report)),
[linkedAction, report],
);
- const prevIsLinkedActionDeleted = usePrevious(linkedAction ? isLinkedActionDeleted : undefined);
+
+ // If true, this variable indicates that a linked action was previously linked correctly, but has been deleted.
+ // In this case, we clear the linked action with Navigation.setParams, and we use this flag to prevent a 404 from
+ // showing during the transition if there are any additional renders before the reportActionIDFromRoute is cleared
+ const [isClearingDeletedLinkedAction, setIsClearingDeletedLinkedAction] = useState(false);
+
const isLinkedActionInaccessibleWhisper = useMemo(
() => !!linkedAction && isWhisperAction(linkedAction) && !(linkedAction?.whisperedToAccountIDs ?? []).includes(currentUserAccountID),
[currentUserAccountID, linkedAction],
@@ -416,11 +421,9 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
(!!deleteTransactionNavigateBackUrl && getReportIDFromLink(deleteTransactionNavigateBackUrl) === report?.reportID) ||
(!reportMetadata.isOptimisticReport && isLoading);
- const isLinkedActionBecomesDeleted = prevIsLinkedActionDeleted !== undefined && !prevIsLinkedActionDeleted && isLinkedActionDeleted;
-
// eslint-disable-next-line rulesdir/no-negated-variables
const shouldShowNotFoundLinkedAction =
- (!isLinkedActionInaccessibleWhisper && isLinkedActionDeleted && !isLinkedActionBecomesDeleted) ||
+ (!isLinkedActionInaccessibleWhisper && isLinkedActionDeleted && !isClearingDeletedLinkedAction) ||
(shouldShowSkeleton &&
!reportMetadata.isLoadingInitialReportActions &&
!!reportActionIDFromRoute &&
@@ -737,11 +740,21 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
useEffect(() => {
// If the linked action is previously available but now deleted,
// remove the reportActionID from the params to not link to the deleted action.
- if (!isLinkedActionBecomesDeleted) {
+ if (!isLinkedActionDeleted || isClearingDeletedLinkedAction) {
return;
}
+ // Set isClearingLinkedAction to true to prevent a 404 showing if there are any re-renders before reportActionIDFromRoute is cleared
+ setIsClearingDeletedLinkedAction(true);
Navigation.setParams({reportActionID: ''});
- }, [isLinkedActionBecomesDeleted]);
+ }, [isLinkedActionDeleted, isClearingDeletedLinkedAction]);
+
+ // Reset the isClearingLinkedAction flag once the reportActionIDFromRoute is cleared
+ useEffect(() => {
+ if (!isClearingDeletedLinkedAction || reportActionIDFromRoute) {
+ return;
+ }
+ setIsClearingDeletedLinkedAction(false);
+ }, [reportActionIDFromRoute, isClearingDeletedLinkedAction]);
// If user redirects to an inaccessible whisper via a deeplink, on a report they have access to,
// then we set reportActionID as empty string, so we display them the report and not the "Not found page". I think this is an improvement over the other proposals here. Also, it's worth noting that when I originally wrote up this suggestion, I used
So we use
It's also worth noting that this lint error would exist in the current code, but the lint error is suppressed in |
📣 @brunovjk 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
📣 @M00rish You have been assigned to this job! |
Thanks! I really appreciate it, I will raise a PR tomorrow at most considering the inputs above. |
Sorry for this delay, I'm on TET holiday and there're only 2-3 PRs that delay from my side (minor updates). I'll try to update all of them in 1-2 days. I spent much time on this issue and my proposal was selected by C+ here, so I think it would be fair that I get partially compensated here. What do you think? cc @JmillsExpensify @brunovjk |
@JmillsExpensify @mallenexpensify What do you think about the point above? |
No, I think @M00rish also found and documented the root cause and had a working solution. Even though your proposal was accepted by the C+, it ultimately wasn't the solution I wanted to see implemented |
@daledah I understand your reasoning, our process uses assignment by the Expensify engineer (or BZ) as the source of truth for consideration for payment. If you would have been hired/assigned, then the issue was reassigned to another, it's possible you would have been due partial compensation. For this instance, compensation isn't due (lil more deets in CONTRIBUTING.md here |
It seems that the automation didn't go well. PR went to production yesterday (Feb 10) on this deploy checklist. |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.85-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): Mac 15.0 / Chrome
Issue reported by: Applause Internal Team
Device used: [email protected]
App Component: Chat Report View
Action Performed:
Expected Result:
Not here page will not show up briefly when deleting the expense while it is highlighted.
Actual Result:
Not here page shows up briefly when deleting the expense while it is highlighted.
Workaround:
Unknown
Platforms:
Screenshots/Videos
bug.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @brunovjkThe text was updated successfully, but these errors were encountered: