Skip to content

[Due for payment 2025-04-30] [$250] Room - User is redirected to "Settings" instead of LHN after creating room while offline. #60398

Closed

Description

@mitarachim

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.1.29-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5944276&group_by=cases:section_id&group_order=asc&group_id=296763
Email or phone of affected tester (no customers): ibellicotest+576@gmail.com
Issue reported by: Applause Internal Team
Device used: Motorola MotoG60 - Android 12 - Chrome
App Component: Other

Action Performed:

  1. Open the Expensify app.
  2. Navigate to "Settings"
  3. Return to LHN.
  4. Turn off internet connection.
  5. Tap on FAB and select "Create Chat"
  6. Select "Room" and complete the creation flow.
  7. Once redirected to chat, tap on room header.
  8. Tap on "Members" and invite a new member.
  9. Return to conversation.
  10. Tap on the arrow on the top left corner to return to LHN.
  11. Check where is the user redirected after this action.

Expected Result:

After the room is created, the back button should redirect the user to LHN.

Actual Result:

When creating a room conversation while offline and inviting a new member, the back button redirects to "Settings" instead of to LHN.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6804405_1744847071293.Settings.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021912707464499254711
  • Upwork Job ID: 1912707464499254711
  • Last Price Increase: 2025-04-17
  • Automatic offers:
    • daledah | Contributor | 106979440
Issue OwnerCurrent Issue Owner: @jliexpensify

Activity

  1. added
    Bug
    Daily
    on Apr 17, 2025
  2. melvin-bot commented on Apr 17, 2025

    @melvin-bot

    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.

  3. added
    External
    on Apr 17, 2025
  4. changed the title [-]Room - User is redirected to "Settings" instead of LHN after creating room while offline.[/-] [+][$250] Room - User is redirected to "Settings" instead of LHN after creating room while offline.[/+] on Apr 17, 2025
  5. melvin-bot commented on Apr 17, 2025

    @melvin-bot
  6. added
    Help Wanted
    on Apr 17, 2025
  7. melvin-bot commented on Apr 17, 2025

    @melvin-bot

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

  8. jliexpensify commented on Apr 17, 2025

    @jliexpensify
    Contributor

    Strange, I agree that we should redirect to LHN.

  9. daledah commented on Apr 17, 2025

    @daledah
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-04-17 03:40:52 UTC.

    Proposal

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

    When creating a room conversation while offline and inviting a new member, the back button redirects to "Settings" instead of to LHN.

    What is the root cause of that problem?

    When creating room:

    const submit = (values: FormOnyxValues<typeof ONYXKEYS.FORMS.NEW_ROOM_FORM>) => {
    setNewRoomFormLoading();
    const participants = [session?.accountID ?? CONST.DEFAULT_NUMBER_ID];
    const parsedDescription = getParsedComment(values.reportDescription ?? '', {policyID});
    const policyReport = buildOptimisticChatReport({
    participantList: participants,
    reportName: values.roomName,
    chatType: CONST.REPORT.CHAT_TYPE.POLICY_ROOM,
    policyID,
    ownerAccountID: CONST.REPORT.OWNER_ACCOUNT_ID_FAKE,
    visibility,
    writeCapability: writeCapability || CONST.REPORT.WRITE_CAPABILITIES.ALL,
    notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.DAILY,
    description: parsedDescription,
    });
    InteractionManager.runAfterInteractions(() => {
    requestAnimationFrame(() => {
    setNewRoomReportID(policyReport.reportID);
    addPolicyReport(policyReport);
    });
    });
    };

    There's a slight delay between setNewRoomFormLoading and setNewRoomReportID because of InteractionManager.runAfterInteractions. In this short amount of time, isLoading is true and newRoomReportID is undefined

    Now let's look at the below useEffect:

    useEffect(() => {
    if (!(((wasLoading && !isLoading) || (isOffline && isLoading)) && isEmptyObject(errorFields))) {
    return;
    }
    if (!newRoomReportID) {
    Navigation.dismissModal();
    return;
    }
    Navigation.dismissModalWithReport({reportID: newRoomReportID});
    // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps -- we just want this to update on changing the form State
    }, [isLoading, errorFields]);

    When online this condition will be always returned early, so no actions is triggered.
    When offline, isOffline && isLoading and isEmptyObject(errorFields) is true, so effect is not returned early. Also, for a short amount of time above, newRoomReportID is undefined, so we dismissModal:

    if (!newRoomReportID) {
    Navigation.dismissModal();
    return;
    }

    Then logics inside addPolicyReport is called, and we navigate again:

    Navigation.dismissModalWithReport({report: policyReport});

    Basically: New room page -> dismissModal to Home -> dismissModalWithReport to room report

    This chain of action removes Home from navigation state, so when clicking back button we returned to the page before Home, which is Settings.

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

    This effect was added in #31655 to handle navigation since they removed dismissModalWithReport in addPolicyReport. After that dismissModalWithReport was added back in addPolicyReport so this effect does not have any purposes anymore.

    I tried removing this effect and the bug in #31655 is not reproduced anymore, so we can remove it.

    useEffect(() => {
    if (!(((wasLoading && !isLoading) || (isOffline && isLoading)) && isEmptyObject(errorFields))) {
    return;
    }
    if (!newRoomReportID) {
    Navigation.dismissModal();
    return;
    }
    Navigation.dismissModalWithReport({reportID: newRoomReportID});
    // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps -- we just want this to update on changing the form State
    }, [isLoading, errorFields]);

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    No need, navigation issue.

    What alternative solutions did you explore? (Optional)

    Move this

    setNewRoomReportID(policyReport.reportID);

    To outside of InteractionManager.runAfterInteractions so it can be called immediately with setNewRoomFormLoading

    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.

  10. mallenexpensify commented on Apr 17, 2025

    @mallenexpensify
    Contributor

    Commented on Slack thread too

    I was assigned as BZ, what a doozy.
    I brokedown steps and inc. screenshot here, they're not particularly helpful now.
    @ariel
    can you share a screenshot of what you see, on your end, for report #1267600385997383 (in OldDot and NewDot plz). I'm particularly perplexed by the Apple charg

    e

  11. 17 remaining items

  12. melvin-bot commented on Apr 23, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.31-3 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 2025-04-30. 🎊

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

  13. melvin-bot commented on Apr 23, 2025

    @melvin-bot

    @hungvu193 @jliexpensify @hungvu193 The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  14. added
    Daily
    and removed
    Weekly
    on Apr 30, 2025
  15. jliexpensify commented on Apr 30, 2025

    @jliexpensify
    Contributor

    Payment Summary

    • C: @daledah $250 (to be paid via Upworks)
    • C+: @hungvu193 $250 (to be paid via New Expensify requests)

    Upwork job

    @hungvu193 - waiting on checklist!

  16. jliexpensify commented on Apr 30, 2025

    @jliexpensify
    Contributor

    Paid, job closed.

  17. hungvu193 commented on May 1, 2025

    @hungvu193
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] 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: https://github.com/Expensify/App/pull/59207/files#r2069856844

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Test:

    1. Login with any account, then turn on the force offline.
    2. Go to Inbox.
    3. Go to Accounts.
    4. Go to Inbox.
    5. Press FAB -> Start chat.
    6. Select room tab and finish room creation.
    7. Once created and navigated to new room, press back button
    8. Verify that the user is navigated to LHN

    Do we agree 👍 or 👎

  18. jliexpensify commented on May 1, 2025

    @jliexpensify
    Contributor

    No checklist needed @hungvu193 ?

  19. hungvu193 commented on May 1, 2025

    @hungvu193
    Contributor

    No checklist needed @hungvu193 ?

    We definitely need it 😆. I'll let you know once it's completed

  20. hungvu193 commented on May 1, 2025

    @hungvu193
    Contributor

    Checklist is completed. I have been struggling to find the offending PR because of the overlapping changes. I'll update here once I found it

  21. jliexpensify commented on May 1, 2025

    @jliexpensify
    Contributor

    @hungvu193 tag me when you're done, I'll close this issue after!

  22. hungvu193 commented on May 1, 2025

    @hungvu193
    Contributor

    @hungvu193 tag me when you're done, I'll close this issue after!

    Found it. Feels free to close 😄

  23. garrettmknight commented on May 12, 2025

    @garrettmknight
    Contributor

    $250 approved for @hungvu193

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions