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] Thread - App shows join button after user joined offline #46004

Closed
1 of 6 tasks
izarutskaya opened this issue Jul 23, 2024 · 17 comments
Closed
1 of 6 tasks

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

izarutskaya opened this issue Jul 23, 2024 · 17 comments
Assignees
Labels
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 Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@izarutskaya
Copy link

izarutskaya commented Jul 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: 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): [email protected]
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
@izarutskaya izarutskaya added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. DeployBlocker Indicates it should block deploying the API labels Jul 23, 2024
Copy link

melvin-bot bot commented Jul 23, 2024

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.

Copy link

melvin-bot bot commented Jul 23, 2024

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

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Jul 23, 2024
Copy link
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.

@izarutskaya
Copy link
Author

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

@izarutskaya
Copy link
Author

Production

Recording.2636.mp4

@MariaHCD
Copy link
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?

@mountiny mountiny removed the DeployBlocker Indicates it should block deploying the API label Jul 23, 2024
@srikarparsi
Copy link
Contributor

This looks frontend, going to try applying the external label

@srikarparsi srikarparsi added the External Added to denote the issue can be worked on by a contributor label Jul 23, 2024
Copy link

melvin-bot bot commented Jul 23, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0114c22d59f2094554

@melvin-bot melvin-bot bot changed the title Thread - App shows join button after user joined offline [$250] Thread - App shows join button after user joined offline Jul 23, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 23, 2024
Copy link

melvin-bot bot commented Jul 23, 2024

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

@Zakpak0
Copy link
Contributor

Zakpak0 commented Jul 24, 2024

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

@srikarparsi
Copy link
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

@brunovjk
Copy link
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

Copy link

melvin-bot bot commented Jul 24, 2024

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

@Zakpak0
Copy link
Contributor

Zakpak0 commented Jul 24, 2024

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 😂

@francoisl
Copy link
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.

@francoisl francoisl added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Jul 24, 2024
@mountiny
Copy link
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

@srikarparsi
Copy link
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
Labels
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 Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
No open projects
Archived in project
Development

No branches or pull requests

8 participants