Skip to content

[HOLD for payment 2024-06-11] HELD ON ONYX BUMP 2.0.40 [$250] FAB - Nothing happens when Start chat is clicked after creating a room offline #40855

Closed

Description

@izarutskaya

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: 1.4.65-0
Reproducible in staging?: Y
Reproducible in production?: Y
Found when executing: https://github.com/Expensify/Expensify/issues/302054
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

  1. Log in with a new account
  2. Create a workspace
  3. Go offline
  4. Create a new room
  5. Navigate to the LHN
  6. Navigate to FAB - Start chat

Expected Result:

Start chat modal should open.

Actual Result:

Nothing happens when Start chat is clicked after creating a room offline. On iOS and Android native, you can see it opening for a short time but it disappears after. On mWeb Safari, the page shakes after the tap.

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

Bug6459380_1713902012941.bandicam_2024-04-23_21-44-21-452.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0114d6fec2c1cc3911
  • Upwork Job ID: 1785002053872132096
  • Last Price Increase: 2024-04-29
  • Automatic offers:
    • bernhardoj | Contributor | 0
Issue OwnerCurrent Issue Owner: @muttmuure / @muttmuure

Activity

  1. added
    Daily
    Bug
    on Apr 24, 2024
  2. melvin-bot commented on Apr 24, 2024

    @melvin-bot

    Triggered auto assignment to @muttmuure (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. izarutskaya commented on Apr 24, 2024

    @izarutskaya
    Author

    We think this issue might be related to the #vip-vsb.

  4. bernhardoj commented on Apr 24, 2024

    @bernhardoj
    Contributor

    Proposal

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

    When we open start chat again after creating a room while offline, nothing happen.

    What is the root cause of that problem?

    When we create a new room, it will optimistically set the loading to the new room form

    App/src/libs/actions/Report.ts

    Lines 1955 to 1957 in 08b7ff4

    onyxMethod: Onyx.METHOD.MERGE,
    key: ONYXKEYS.FORMS.NEW_ROOM_FORM,
    value: {isLoading: true},

    Because we are offline, the loading state is always true. When we reopen the page again, it will immediately close because of the below effect.

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

    The (isOffline && isLoading) condition is true. When the page is mounted, we clear the loading state (set to false)

    useEffect(() => {
    Report.clearNewRoomFormError();
    }, []);

    and this condition (wasLoading && !isLoading) is also becomes true.

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

    The useEffect is added (in #31655) so it will only close the page when the request is successful, but we added back the code to close it immediately in Report.addPolicyReport, so it's really weird, I think it's a bad merge, so we can remove the dismiss code here.

    App/src/libs/actions/Report.ts

    Lines 2012 to 2013 in 08b7ff4

    API.write(WRITE_COMMANDS.ADD_WORKSPACE_ROOM, parameters, {optimisticData, successData, failureData});
    Navigation.dismissModalWithReport(policyReport);

    To fix this issue, we can set initWithStoredValues: false to the new room form state. This way, the data will always be empty initially. We don't want the previous state to affect the new page.

    formState: {
        key: ONYXKEYS.FORMS.NEW_ROOM_FORM,
        initWithStoredValues: false,
    },
    

    Then, we can remove this effect

    useEffect(() => {
    Report.clearNewRoomFormError();
    }, []);

    Or trigger it when it's unmounted instead.

    NOTE: there is currently a bug in Onyx where initWithStoredValues doesn't work. To fix it we should initialize the onyx key only if initWithStoredValues is true.

    -if (
    +if (mapping.initWithStoredValues &&
        ((value !== undefined
            && !Onyx.hasPendingMergeForKey(key))
        || mapping.allowStaleData)
    ) {
  5. added
    External
    on Apr 29, 2024
  6. melvin-bot commented on Apr 29, 2024

    @melvin-bot
  7. changed the title [-]FAB - Nothing happens when Start chat is clicked after creating a room offline[/-] [+][$250] FAB - Nothing happens when Start chat is clicked after creating a room offline[/+] on Apr 29, 2024
  8. added
    Help Wanted
    on Apr 29, 2024
  9. melvin-bot commented on Apr 29, 2024

    @melvin-bot

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

  10. muttmuure commented on May 1, 2024

    @muttmuure
    Contributor

    @mollfpr there's a proposal above for you to take a look at

  11. 56 remaining items

  12. melvin-bot commented on Jun 18, 2024

    @melvin-bot

    @puneetlath, @mollfpr, @muttmuure, @bernhardoj Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  13. mollfpr commented on Jun 18, 2024

    @mollfpr
    Contributor

    [@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
    [@mollfpr] 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:

    No offending PR.

    [@mollfpr] 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:
    [@mollfpr] Determine if we should create a regression test for this bug.

    The regression step should be enough.

    [@mollfpr] 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.

    1. Go offline
    2. Create a new room from FAB
    3. Open the new room page again from FAB
    4. Verify the new room page is shown
    5. 👍 or 👎
  14. muttmuure commented on Jun 20, 2024

    @muttmuure
    Contributor

    @mollfpr - $250 C+

  15. JmillsExpensify commented on Jun 22, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @mollfpr

  16. melvin-bot commented on Jun 24, 2024

    @melvin-bot

    @puneetlath, @mollfpr, @muttmuure, @bernhardoj Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  17. puneetlath commented on Jun 25, 2024

    @puneetlath
    Contributor

    @muttmuure what is left to do here? Can we close?

  18. bernhardoj commented on Jun 26, 2024

    @bernhardoj
    Contributor

    I think the payment for me is still pending.

  19. muttmuure commented on Jun 27, 2024

    @muttmuure
    Contributor

    @bernhardoj paid $250 for C

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