Skip to content
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 2023-09-06] [$1000] Web - On reload on attachment preview and close, app displays random chat for few seconds #23958

Closed
1 of 6 tasks
kbecciv opened this issue Jul 31, 2023 · 52 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented Jul 31, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Open the app
  2. Open any report
  3. Send any image attachment
  4. Click and open attachment in preview
  5. Copy the attachment preview url
  6. Go to other chat
  7. Paste the saved url in the current search bar
  8. Reload
  9. Close the preview and observe that app displays random chat for few seconds before again displaying the right chat

Expected Result:

App should display same chat in which attachment is located when we close the preview - navigation should occur before closing the modal

Actual Result:

App displays random chat when we click on attachment, reload on preview and close the preview

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.47.3
Reproducible in staging?: n/a
Reproducible in production?: n/a
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

app.displays.random.chat.on.closing.preview.after.reload.mp4

Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1690103101672499

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~015ceaa38feb4bfce8
  • Upwork Job ID: 1687635491784937472
  • Last Price Increase: 2023-08-05
  • Automatic offers:
    • tienifr | Contributor | 26201629
    • dhanashree-sawant | Reporter | 26201630
@kbecciv kbecciv added Daily KSv2 Needs Reproduction Reproducible steps needed Bug Something is broken. Auto assigns a BugZero manager. labels Jul 31, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 31, 2023

Triggered auto assignment to @sakluger (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jul 31, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@tienifr
Copy link
Contributor

tienifr commented Aug 1, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Web - On reload on attachment preview and close, app displays random chat for few seconds

What is the root cause of that problem?

The attachment view is main route, meanwhile the report screen is center pane so it's not related to each other.

[SCREENS.REPORT_ATTACHMENTS]: ROUTES.REPORT_ATTACHMENTS,
// Sidebar
[SCREENS.HOME]: {
path: ROUTES.HOME,
},
[NAVIGATORS.CENTRAL_PANE_NAVIGATOR]: {
screens: {
[SCREENS.REPORT]: ROUTES.REPORT_WITH_ID,
},
},

The url of attachment view is /r/7572730112622440/attachment, it is not center pane so in ReportScreenWrapper we can't get the reportID, that why we get the last access report id to render in center pane

// If there is no reportID in route, try to find last accessed and use it for setParams
const reportID = getLastAccessedReportID(

the last access report id is different from the report id in url, so when we dismiss the attachment modal, we back to the current report then back to the report that contains attachment preview

onModalHide={() => Navigation.dismissModal(reportID)}

What changes do you think we should make in order to solve the problem?

  1. Prior navigate to the parent report
    In
    const getLastAccessedReportID = (reports, ignoreDefaultRooms, policies, isFirstTimeNewExpensifyUser, openOnAdminRoom) => {
    const lastReport = ReportUtils.findLastAccessedReport(reports, ignoreDefaultRooms, policies, isFirstTimeNewExpensifyUser, openOnAdminRoom);
    return lodashGet(lastReport, 'reportID');
    };

We should additionally check the current route has the reportID not not by using Navigation.getActiveRoute()

Here's the code sample

    const currentRoute = Navigation.getActiveRoute();
    const regex = /\/r\/(\d*)\/attachment/;
    const reportID = regex.exec(currentRoute)[1] // should add null check
    if(reportID) return  reportID;
  1. Avoid navigating to the parent report after closing modal

Remove reportID in

onModalHide={() => Navigation.dismissModal(reportID)}

Result

Screen.Recording.2023-08-01.at.11.37.05.mov

@tienifr
Copy link
Contributor

tienifr commented Aug 1, 2023

@dhanashree-sawant @sakluger I think we should change the steps for more correct

  1. Open the app
  2. Open any report
  3. Send any image attachment
  4. Click and open attachment in preview
  5. Copy the attachment preview url
  6. Go to other chat
  7. Paste the saved url in the current search bar
  8. Reload
  9. Close the preview and observe that app displays random chat for few seconds before again displaying the right chat

@dhanashree-sawant
Copy link

Okay yes, @tienifr steps seems better, if @sakluger is also able to reproduce with that step, we can change it.

@sakluger
Copy link
Contributor

sakluger commented Aug 1, 2023

@tienifr thanks for providing those steps. Just to confirm, can you reproduce this issue consistently with those updated steps?

@tienifr
Copy link
Contributor

tienifr commented Aug 1, 2023

Yes, I can @sakluger

@melvin-bot melvin-bot bot added the Overdue label Aug 3, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 4, 2023

@sakluger Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@sakluger sakluger added External Added to denote the issue can be worked on by a contributor and removed Needs Reproduction Reproducible steps needed labels Aug 5, 2023
@melvin-bot melvin-bot bot changed the title Web - On reload on attachment preview and close, app displays random chat for few seconds [$1000] Web - On reload on attachment preview and close, app displays random chat for few seconds Aug 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 5, 2023

Job added to Upwork: https://www.upwork.com/jobs/~015ceaa38feb4bfce8

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 5, 2023

Current assignee @sakluger is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Aug 5, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @rushatgabhane (External)

@sakluger
Copy link
Contributor

sakluger commented Aug 5, 2023

Updated the reproduction steps in the original description, thanks!

@melvin-bot melvin-bot bot removed the Overdue label Aug 5, 2023
@bernhardoj
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

Closing the attachment carousel will show the last access report and then navigate to the report of the attachment.

What is the root cause of that problem?

When we refresh the app while the attachment carousel or any RHP is open, it will manually push the report screen to the navigation stack with empty params.

// Make sure that there is at least one CentralPaneNavigator (ReportScreen by default) in the state if this is a wide layout
if (!isAtLeastOneCentralPaneNavigatorInState(partialState) && !options.isSmallScreenWidth) {
// If we added a route we need to make sure that the state.stale is true to generate new key for this route
// eslint-disable-next-line no-param-reassign
partialState.stale = true;
addCentralPaneNavigatorRoute(partialState);
}

/**
* Adds report route without any specific reportID to the state.
* The report screen will self set proper reportID param based on the helper function findLastAccessedReport (look at ReportScreenWrapper for more info)
*
* @param {Object} state - react-navigation state
*/
const addCentralPaneNavigatorRoute = (state) => {
state.routes.splice(1, 0, {name: NAVIGATORS.CENTRAL_PANE_NAVIGATOR});
// eslint-disable-next-line no-param-reassign
state.index = state.routes.length - 1;
};

If the param is empty, we will show the last accessed report id instead.

// If there is no reportID in route, try to find last accessed and use it for setParams
const reportID = getLastAccessedReportID(
props.reports,
!canUseDefaultRooms,
props.policies,
props.isFirstTimeNewExpensifyUser,
lodashGet(props.route, 'params.openOnAdminRoom', false),
);

In step 6, we go to another chat, which means the last accessed chat is not the chat that we send the attachment to. So, when we close the attachment carousel, it will show the last accessed report first (this is totally expected), and then show the report of the attachment. This is because we are calling Navigation.dismissModal(reportID) when the modal hides.

onModalHide={() => Navigation.dismissModal(reportID)}

Navigation.dismissModal(reportID) will replace the current screen with the passed reportID.

Btw, we can simplify the reproduction steps to:

  1. Send an attachment to chat A
  2. Open the attachment and copy the URL
  3. Send the attachment URL to chat B
  4. Click the attachment URL in chat B
  5. Close the attachment carousel

After the carousel is closed, we will be navigated to chat A. This is the real issue.

What changes do you think we should make in order to solve the problem?

When the carousel closed, just close it, no need to navigate to other report. To do that, we can either

  1. Remove reportID from dismissModal
    OR
  2. Replace dismissModal with goBack

@rushatgabhane
Copy link
Member

I like @tienifr's proposal! #23958 (comment)
C+ reviewed 🎀 👀 🎀

@melvin-bot
Copy link

melvin-bot bot commented Aug 5, 2023

Triggered auto assignment to @Julesssss, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@rushatgabhane
Copy link
Member

@bernhardoj thanks for your proposal but I think we should display the report where attachment is coming from vs the last acessed report id

@bernhardoj
Copy link
Contributor

@rushatgabhane thanks for the review.

  1. Send an attachment to chat A
  2. Open the attachment and copy the URL
  3. Send the attachment URL to chat B
  4. Click the attachment URL in chat B
  5. Close the attachment carousel

After the carousel is closed, we will be navigated to chat A. This is the real issue.

What about this case? Navigating the user to the report of the attachment after closing the carousel is really annoying.

display the report where attachment is coming from

If you think we should do this, then I think we should do the same for other report sub-pages to make it consistent? For example, report settings (and sub-pages), participants, etc.

@tienifr
Copy link
Contributor

tienifr commented Aug 7, 2023

What about this case? Navigating the user to the report of the attachment after closing the carousel is really annoying.

I don't think so, the attachment URL is just same like the internal link, when we click on the internal link, we should navigate to that page.

If you think we should do this, then I think we should do the same for other report sub-pages to make it consistent? For example, report settings (and sub-pages), participants, etc.

The profile pages are not the same as attachment modal.

  1. The attachment modals belong to the report, that why when we hide the attachment modal, we should open the chat accordingly
  2. The url of attachment modal is /r/:reportID/attachment? so we should open the correct report after hide modal. Otherwise, the url of profile page is /a/accountID, do not depends on the report => we don't need to display the report after closing this page

@Julesssss
Copy link
Contributor

FYI I am OOO this week. Feel free to reassign in the meantime, or I will be back on Monday 28th

@melvin-bot
Copy link

melvin-bot bot commented Aug 23, 2023

Triggered auto assignment to @cristipaval (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@sakluger
Copy link
Contributor

@cristipaval I've assigned you to help review the PR: #25521

If you can't review, let us know, @Julesssss can do it when he's back.

@melvin-bot
Copy link

melvin-bot bot commented Aug 25, 2023

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @tienifr got assigned: 2023-08-18 17:22:28 Z
  • when the PR got merged: 2023-08-25 12:07:23 UTC
  • days elapsed: 4

On to the next one 🚀

@cristipaval
Copy link
Contributor

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @tienifr got assigned: 2023-08-18 17:22:28 Z
  • when the PR got merged: 2023-08-25 12:07:23 UTC
  • days elapsed: 4

On to the next one 🚀

I think that's because @Julesssss is ooo and I was busy with wave4 stuff. PR was ready earlier

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Aug 30, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Web - On reload on attachment preview and close, app displays random chat for few seconds [HOLD for payment 2023-09-06] [$1000] Web - On reload on attachment preview and close, app displays random chat for few seconds Aug 30, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 30, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot
Copy link

melvin-bot bot commented Aug 30, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.58-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-09-06. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter - $250
  • Contributor that fixed the issue - $1500
  • Contributor+ that helped on the issue and/or PR - $1500

For reference, here are some details about the assignees on this issue:

Efficiency bonus applies to payments above! 🎉 🚀

@melvin-bot
Copy link

melvin-bot bot commented Aug 30, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@rushatgabhane] The PR that introduced the bug has been identified. Link to the PR:
  • [@rushatgabhane] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@rushatgabhane] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@rushatgabhane] Determine if we should create a regression test for this bug.
  • [@rushatgabhane] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@sakluger] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Sep 5, 2023
@sakluger
Copy link
Contributor

sakluger commented Sep 5, 2023

I went ahead and paid out the reporter bounty to @dhanashree-sawant

@rushatgabhane could you please complete the BZ checklist by tomorrow? That way we can approve your manual payment right away after the 7-day hold.

@rushatgabhane
Copy link
Member

rushatgabhane commented Sep 5, 2023

  1. The PR that introduced the bug has been identified. Link to the PR: This is more like a new feature. The old behavior always existed and wasn't introduced by any PR.

  2. The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: N.A.

  3. A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: N.A.

  4. Determine if we should create a regression test for this bug. - No

  5. If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again - N.A.

@rushatgabhane
Copy link
Member

Created a manual request here - https://staging.new.expensify.com/r/6288901853355212

@sakluger
Copy link
Contributor

sakluger commented Sep 6, 2023

Thanks @rushatgabhane! I assigned @JmillsExpensify to handle the payment request.

Everyone else has been paid out, I'll leave this open so Jason can approve the final payment.

@sakluger
Copy link
Contributor

sakluger commented Sep 8, 2023

We're good to close, the NewDot payment requests will be handled.

@sakluger sakluger closed this as completed Sep 8, 2023
@JmillsExpensify
Copy link

$1,500 payment approved for @rushatgabhane based on BZ summary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

9 participants