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

[$250] Distance - "Error loading messages" appears after dismissing invalid distance error #42518

Closed
6 tasks done
lanitochka17 opened this issue May 23, 2024 · 54 comments
Closed
6 tasks done
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Internal Requires API changes or must be handled by Expensify staff Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented May 23, 2024

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: 1.4.75-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Issue found when executing PR #41481

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat that has no unsettled request
  3. Go offline
  4. Submit a distance expense with invalid addresses
  5. Go online
  6. Click on the distance preview
  7. Dismiss the error message
  8. Click on the header subtitle to return to the main chat
  9. Scroll down

Expected Result:

There will be no "There was an error loading more messages." in the main chat

Actual Result:

"There was an error loading more messages." error shows up in the main chat after dismissing the error

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6489312_1716463242950.20240523_183441.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~013c3c05166994ac09
  • Upwork Job ID: 1795874267241521152
  • Last Price Increase: 2024-08-08
Issue OwnerCurrent Issue Owner: @ishpaul777
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 23, 2024
Copy link

melvin-bot bot commented May 23, 2024

Triggered auto assignment to @JmillsExpensify (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.

@lanitochka17
Copy link
Author

@JmillsExpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@lanitochka17
Copy link
Author

We think that this bug might be related to #wave-collect - Release 1

@jainilparikh
Copy link

jainilparikh commented May 25, 2024

Proposal

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

Error message "There was an error loading more messages" is visible even when there is no error in the chat flow (The error is in the MoneyRequestView).

What is the root cause of that problem?

The error message "There was an error loading more messages" in the chat view is controlled by the flag: hasLoadingNewerReportActionsError which is a part of ReportMetadata. When we close the error modal (The modal that shows Route exceeded... ) this flag is not flipped.

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

Create a new function in ReportActions.tsx as such:

function callOnxyMerge(reportID: string) {
    Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`, {
        isLoadingInitialReportActions: false,
        hasLoadingNewerReportActionsError: false,
    });
}

and call that when the error modal closes, here:

https://github.com/Expensify/App/blob/main/src/components/ReportActionItem/MoneyRequestView.tsx#L356

This will flip the hasLoadingNewerReportActionsError flag to false, hence, when the user navigates back to the main chat view, the error message There was an error loading more messages won't be visible.

@melvin-bot melvin-bot bot added the Overdue label May 25, 2024
Copy link

melvin-bot bot commented May 28, 2024

@JmillsExpensify Eep! 4 days overdue now. Issues have feelings too...

@JmillsExpensify
Copy link

Opening up to the community since we have a proposal.

@melvin-bot melvin-bot bot removed the Overdue label May 29, 2024
@JmillsExpensify JmillsExpensify added External Added to denote the issue can be worked on by a contributor Overdue labels May 29, 2024
Copy link

melvin-bot bot commented May 29, 2024

Job added to Upwork: https://www.upwork.com/jobs/~013c3c05166994ac09

@melvin-bot melvin-bot bot changed the title Distance - "Error loading messages" appears after dismissing invalid distance error [$250] Distance - "Error loading messages" appears after dismissing invalid distance error May 29, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 29, 2024
Copy link

melvin-bot bot commented May 29, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label May 29, 2024
@ishpaul777
Copy link
Contributor

Thanks for your proposal @jainilparikh, but to be able to evaluate the proposal I might need more details and a detailed Root cause Analysis, Would you mind adding more details to your proposal

Copy link

melvin-bot bot commented Jun 5, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Jun 5, 2024
@ishpaul777
Copy link
Contributor

Awaiting proposals

@melvin-bot melvin-bot bot removed the Overdue label Jun 5, 2024
@goldenbear101
Copy link

Proposal

Please re-state the problem that we are trying to solve in this issue.
Error message "There was an error loading more messages" is visible even when there is no error in the chat flow (The error is in the MoneyRequestView).

What is the root cause of that problem?
I think there is a bug where the error message from the MoneyRequestView propagates to the chat view, causing the "Error loading messages" error to display after dismissing an invalid distance error.

What changes do you think we should make in order to solve the problem?
The suggested fix involves making sure that when the error modal in MoneyRequestView is dismissed, the state indicating an error in loading messages is reset.

The state hasLoadingNewerReportActionsError should be reset to false in Onyx when the error modal is dismissed in MoneyRequestView.

Steps to fix:
1, I will check how the state hasLoadingNewerReportActionsError is managed in MoneyRequestView and ChatView.
2, Modify MoneyRequestView to reset the error state by ensuring that dismissing the error modal triggers an update to reset hasLoadingNewerReportActionsError in Onyx.
3, Update the MoneyRequestView component, find where the error modal is dismissed and add code to reset the hasLoadingNewerReportActionsError state in Onyx.
4, Make sure the Onyx key hasLoadingNewerReportActionsError is correctly defined and can be updated from the MoneyRequestView.

Implementation:
1, Finding the dismiss error modal code in MoneyRequestView:

// Assuming the error modal dismissal is handled in a function like this:
dismissErrorModal() {
    this.setState({ showErrorModal: false });

    // Add code to reset the error state in Onyx
    Onyx.merge(ONYXKEYS.REPORT_HAS_LOADING_NEWER_REPORT_ACTIONS_ERROR, false);
}

2, Ensure Onyx Key is Defined:

Verify that ONYXKEYS.REPORT_HAS_LOADING_NEWER_REPORT_ACTIONS_ERROR is properly defined in your Onyx keys:

// ONYXKEYS.js
const ONYXKEYS = {
    ...
    REPORT_HAS_LOADING_NEWER_REPORT_ACTIONS_ERROR: 'hasLoadingNewerReportActionsError',
    ...
};
export default ONYXKEYS;

3, Handle State Reset in Onyx:

Make sure the state is properly updated in Onyx when merging:

Onyx.merge(ONYXKEYS.REPORT_HAS_LOADING_NEWER_REPORT_ACTIONS_ERROR, false);
What alternative solutions did you explore? (Optional)

This approach is to make sure that the state indicating an error in loading messages is properly reset, to avoid the propagation of the error to the chat view.

@ishpaul777
Copy link
Contributor

@goldenbear101 Thanks for your interest in this issue, I suggest you please take a look at our contribution guildelines and few issues where contributors have posted proposals and get yourself familiarized with the codebase and try writing a detailed proposal on where & what to change and for a proposal to be evaluated it's important to put accurate and detailed RCA.

Copy link

melvin-bot bot commented Jun 6, 2024

@JmillsExpensify @ishpaul777 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!

@ishpaul777
Copy link
Contributor

we are looking for proposals

@jainilparikh
Copy link

jainilparikh commented Jun 9, 2024

Updated: #42518 (comment)

CC: @ishpaul777 for review

@NJ-2020
Copy link
Contributor

NJ-2020 commented Jun 10, 2024

Proposal

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

"Error loading messages" appears after dismissing an invalid distance error

What is the root cause of that problem?

The backend will show an error because of the invalid address so it won't create the report including the report ID in the backend, but we still keep the ONYX data so when we click the subheader link, we pass the parent report ID and thread report id (which doesn't exist because backend error) to getNewerActions function

Report.getNewerActions(reportID, newestReportAction.reportActionID);

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

We can check if the report ID exists in the backend, and then we can invoke the getNewerActions

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Weekly KSv2 label Aug 2, 2024
Copy link

melvin-bot bot commented Aug 2, 2024

This issue has not been updated in over 14 days. @JmillsExpensify, @allroundexperts eroding to Weekly issue.

@melvin-bot melvin-bot bot removed the Overdue label Aug 2, 2024
Copy link

melvin-bot bot commented Aug 8, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Aug 12, 2024
@JmillsExpensify JmillsExpensify added Internal Requires API changes or must be handled by Expensify staff and removed External Added to denote the issue can be worked on by a contributor labels Aug 14, 2024
@JmillsExpensify
Copy link

Waiting on an internal fix.

@melvin-bot melvin-bot bot removed the Overdue label Aug 14, 2024
@melvin-bot melvin-bot bot added the Overdue label Aug 22, 2024
@JmillsExpensify
Copy link

Still waiting on internal

@melvin-bot melvin-bot bot removed the Overdue label Aug 28, 2024
@trjExpensify
Copy link
Contributor

Ah, so @JmillsExpensify do you need a volunteer here or is someone on it? If so, let's make sure it goes in Hot picks to surface it.

@melvin-bot melvin-bot bot added the Overdue label Sep 5, 2024
@JmillsExpensify JmillsExpensify moved this from Polish to HOT PICKS in [#whatsnext] #wave-collect Sep 11, 2024
@JmillsExpensify
Copy link

Done! Added to hot picks.

@melvin-bot melvin-bot bot removed the Overdue label Sep 11, 2024
@melvin-bot melvin-bot bot added the Overdue label Sep 19, 2024
@JmillsExpensify
Copy link

Still in hot picks

@melvin-bot melvin-bot bot removed the Overdue label Sep 25, 2024
@tgolen tgolen self-assigned this Sep 30, 2024
@tgolen
Copy link
Contributor

tgolen commented Sep 30, 2024

I can work on this, but I need some help getting a little more crisp on just what the expected problem is on the backend. I see this:

Backend seems to be returning hasLoadingNewerReportActionsError as true.

but hasLoadingNewerReportActionsError doesn't seem to come from the backend anywhere. I can find no reference to it. Should I be looking for something else? Are you sure this comes from the backend? Is it maybe inserted into Onyx as true due to this failureData?

hasLoadingNewerReportActionsError: true,

If it is, can you help me understand what needs to happen differently?

@trjExpensify
Copy link
Contributor

@allroundexperts can you get back to Tim on the above, please?

@allroundexperts
Copy link
Contributor

@tgolen I was assuming that it comes from the backend. If it does not (and you can confirm that), then flipping the flag as suggested by @jainilparikh should work fine. I'll test this out and get back.

@tgolen
Copy link
Contributor

tgolen commented Oct 2, 2024

I can confirm that I can't find it coming from the backend anywhere 👍

@trjExpensify
Copy link
Contributor

Okay cool, so what are our next steps here? Proceed with @jainilparikh's proposal?

@allroundexperts
Copy link
Contributor

@trjExpensify I just tested this again, and am unable to reproduce it. Can you please check as well?

@trjExpensify
Copy link
Contributor

Can do! It looks like we now actually delete the whole thing if it was created offline with invalid waypoints:

2024-10-07_11-17-03.mp4

Seems like it was fixed as part of this issue: #42950 (comment)

Closing!

@github-project-automation github-project-automation bot moved this from HOT PICKS to Done in [#whatsnext] #wave-collect Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Internal Requires API changes or must be handled by Expensify staff Weekly KSv2
Projects
No open projects
Status: Done
Development

No branches or pull requests

9 participants