Skip to content

[$250] Thread - App shows join button after user joined offline #46004

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: v9.0.11-0
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4753350
Email or phone of affected tester (no customers): bezawitgebremichael+100@gmail.com
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team *

Action Performed:

  1. Navigate to staging.new.expensify.com
  2. Click on FAB
  3. Click on start chat
  4. Insert an email address and start a chat
  5. Send a message
  6. Hover over the message and click on reply in thread
  7. Send some messages
  8. Open the network tab and go offline
  9. Click on thread header
  10. Click on leave
  11. Click on Join
  12. Go online

Expected Result:

The user stays joined back in the thread

Actual Result:

The join button reappears again and user has to click join again

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

Bug6549717_1721667673800.bandicam_2024-07-22_19-54-35-010.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0114c22d59f2094554
  • Upwork Job ID: 1815812057496731128
  • Last Price Increase: 2024-07-23
Issue OwnerCurrent Issue Owner: @brunovjk

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    on Jul 23, 2024
  2. melvin-bot commented on Jul 23, 2024

    @melvin-bot

    Triggered auto assignment to @alexpensify (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. melvin-bot commented on Jul 23, 2024

    @melvin-bot

    Triggered auto assignment to @srikarparsi (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  4. github-actions commented on Jul 23, 2024

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. izarutskaya commented on Jul 23, 2024

    @izarutskaya
    Author

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

  6. izarutskaya commented on Jul 23, 2024

    @izarutskaya
    Author

    Production

    Recording.2636.mp4
  7. MariaHCD commented on Jul 23, 2024

    @MariaHCD
    Contributor

    At first glance, this seems like a frontend issue 🤔 I see LeaveRoom was called when the user got back online but maybe we should have also called the Api command to rejoin the thread?

  8. 6 remaining items

  9. melvin-bot commented on Jul 23, 2024

    @melvin-bot

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

  10. Zakpak0 commented on Jul 24, 2024

    @Zakpak0
    Contributor

    Proposal

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

    After creating a thread, if a user was to go offline then leave the thread and then rejoin, the join button will appear on the screen when it is not supposed to be there.

    What is the root cause of that problem?

    When the user is brought back online the Sequential Queue processes the requests that weren't able to be made while the user is offline.
    This means:
    User leaves thread -> User rejoins thread
    In that order.
    So after the User Left Thread request, there is a period that the User Rejoined Thread request had not been completed.

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

    Add a pending field to our notification update function so we have a flag to look for while we're processing actions.
    src/libs/actions/Report.ts

        const optimisticData: OnyxUpdate[] = [
            {
                onyxMethod: Onyx.METHOD.MERGE,
                key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
                value: {
                    notificationPreference: newValue,
                    pendingFields: {
                        notificationPreference: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE
                    }
                },
            },
        ];
        const successData: OnyxUpdate[] = [
            {
                onyxMethod: Onyx.METHOD.MERGE,
                key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
                value: {
                    pendingFields: {
                        notificationPreference: null
                    }
                },
            },
        ];

    Then modify our canJoin boolean to read that flag and be patient.
    src/pages/home/HeaderView.tsx

        const isPendingNotificationUpdate = report?.pendingFields?.notificationPreference
        const canJoin = useMemo(() => {
            if (isPendingNotificationUpdate) {
                return false
            }
            return ReportUtils.canJoinChat(report, parentReportAction, policy);
        }, [isPendingNotificationUpdate]) 

    Here is a test branch with my changes

    What alternative solutions did you explore? (Optional)

    N/A

  11. srikarparsi commented on Jul 24, 2024

    @srikarparsi
    Contributor

    To clarify from the issue body, the join button does disappear after a moment. The leave button isn't currently in prod so it's a little difficult to compare. @mountiny do you know if this is expected with the sequential queue or should this be fixed?

    Screen.Recording.2024-07-24.at.4.30.02.AM.mov
  12. brunovjk commented on Jul 24, 2024

    @brunovjk
    Contributor

    If @mountiny confirm "... sequential queue ... should this be fixed" I think we can go with @Zakpak0's proposal, I tested they branch and LGTM.

    🎀👀🎀 C+ reviewed

  13. melvin-bot commented on Jul 24, 2024

    @melvin-bot

    Current assignee @srikarparsi is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

  14. Zakpak0 commented on Jul 24, 2024

    @Zakpak0
    Contributor

    Personally, in my three weeks contributing so far, I think this is the third time I've come across an offline/online issue where the queue is processing causing state to repeatedly re-render. Sometimes it's handled and sometimes it isn't. It makes me wish Onyx had an offline state and the sequential queue was a plugin that informs Onyx when it's empty and it's safe to output the results.
    In the comments about the queue it mentions that they're run in order so that the expect results turns out exactly as the user input it while offline. And it makes sense, calculating an end result and simply displaying that might create confusion.
    But I'm kind of tempted to crack open the code and try anyway for fun 😂

  15. francoisl commented on Jul 24, 2024

    @francoisl
    Contributor

    Thanks for the proposals so far. Can you identify which PR from the checklist caused the regression? Anyway, going to demote as a polish issue since it's for offline behavior that doesn't break any critical flow.

  16. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Jul 24, 2024
  17. mountiny commented on Jul 25, 2024

    @mountiny
    Contributor

    I think this is happening as we process the API commands in the backend and we queue the relevant onyx updates. First, the app processes, leaving the thread so it gets hidden and then it joins again.

    I think we do not have to worry about this one too much and might even close it

  18. srikarparsi commented on Jul 29, 2024

    @srikarparsi
    Contributor

    I agree, closing this one out since the expected behavior (the join button not showing) does occur, it just takes a second because of the sequential queue.

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions