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

[$500] Workspace - Infinite skeleton loading when member is removed from Workspace #35751

Closed
1 of 6 tasks
lanitochka17 opened this issue Feb 3, 2024 · 57 comments
Closed
1 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Feb 3, 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.36-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:
Email or phone of affected tester (no customers): [email protected]
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. User A creates Workspace> Members> Invite User B
  2. Login as User B and navigate to Announce room
  3. User A removes User B

Expected Result:

Announce room should be archived

Actual Result:

Infinite skeleton loading when member is removed from Workspace

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

Bug6365844_1706961916414.Gravar__2034.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01562b797682c4ff91
  • Upwork Job ID: 1753799520257306624
  • Last Price Increase: 2024-02-10
  • Automatic offers:
    • aimane-chnaif | Contributor | 0
@lanitochka17 lanitochka17 added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Feb 3, 2024
Copy link

melvin-bot bot commented Feb 3, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01562b797682c4ff91

@melvin-bot melvin-bot bot changed the title Workspace - Infinite skeleton loading when member is removed from Workspace [$500] Workspace - Infinite skeleton loading when member is removed from Workspace Feb 3, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 3, 2024
Copy link

melvin-bot bot commented Feb 3, 2024

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

Copy link

melvin-bot bot commented Feb 3, 2024

Triggered auto assignment to @dylanexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@lanitochka17
Copy link
Author

We think that this bug might be related to #wave6
CC @greg-schroeder

@Amoralchik
Copy link
Contributor

Amoralchik commented Feb 3, 2024

Proposal

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

The issue at hand revolves around the persistence of wasReportAccessibleRef.current as true despite the modification of the report's state.

What is the root cause of that problem?

The core problem stems from the oversight of not updating wasReportAccessibleRef.current to false when the specified condition indicates that the report is inaccessible.

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

To resolve this issue, I propose implementing a correction in the code. Specifically, by introducing the following adjustment in the useEffect block:

useEffect(() => {
    if (!report || !report.reportID || shouldHideReport) {
        wasReportAccessibleRef.current = false;
        return;
    }
    wasReportAccessibleRef.current = true;
}, [shouldHideReport, report]);

This change ensures that wasReportAccessibleRef.current accurately reflects the accessibility state based on the specified conditions.

What alternative solutions did you explore? (Optional)

@dukenv0307
Copy link
Contributor

dukenv0307 commented Feb 5, 2024

Proposal

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

  • Workspace - Infinite skeleton loading when member is removed from Workspace

What is the root cause of that problem?

  • After removing user B, in user B device, it will set the current report to null so the isReportReadyForDisplay is false.

  • In ReportScreen, we display the "loading indicator" because the isReportReadyForDisplay is false and shouldShowNotFoundPage is false (If shouldShowNotFoundPage is true, it will display the FullPageNotFoundView rather than "loading indicator":

  • Additionally, shouldShowNotFoundPage is false because wasReportAccessibleRef is set to true in the below:

    useEffect(() => {
    if (!report || !report.reportID || shouldHideReport) {
    return;
    }
    wasReportAccessibleRef.current = true;
    }, [shouldHideReport, report]);

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

  • We can display the FullPageNotFoundView in this case. Do it by creating a ref called wasPolicyAnnounceAccessibleButNotNowRef = useRef(false) (This is used to track if the report that has report.chatType === "policyAnnounce" was accessible but now is not) and update it to true in the below logic:
 const prevPolicy = usePrevious(policy);
 const accessibleReport = useRef();
 useEffect(() => {
        if (accessibleReport.current && accessibleReport.current.chatType === CONST.REPORT.CHAT_TYPE.POLICY_ANNOUNCE && wasReportAccessibleRef.current && !wasPolicyAnnounceAccessibleButNotNowRef.current) {
            if (isEmpty(policy) && !isEmpty(prevPolicy)) {
                wasPolicyAnnounceAccessibleButNotNowRef.current = true;
            }
        }
    }, [prevReport.reportID, wasReportAccessibleRef, wasPolicyAnnounceAccessibleButNotNowRef, policy, prevPolicy]);
   const shouldShowNotFoundPage = useMemo(
        () =>
            (!wasReportAccessibleRef.current &&
                !firstRenderRef.current &&
                !report.reportID &&
                !isOptimisticDelete &&
                !reportMetadata.isLoadingInitialReportActions &&
                !isLoading &&
                !userLeavingStatus) ||
            shouldHideReport ||
+         wasPolicyAnnounceAccessibleButNotNowRef.current,
        [report, reportMetadata, isLoading, shouldHideReport, isOptimisticDelete, userLeavingStatus],
    );
  • Beside policyAnnounce, we can do the same with other chat type

What alternative solutions did you explore? (Optional)

  • NA

@dylanexpensify
Copy link
Contributor

@parasharrajat can you review proposals?

@dylanexpensify
Copy link
Contributor

@zanyrenney curious what you think of this for wave8?

@parasharrajat
Copy link
Member

@Amoralchik Could you please explain your proposal?

@Amoralchik
Copy link
Contributor

@Amoralchik Could you please explain your proposal?

Okay, I have reconsidered my decision.

The primary issue lies in the fact that wasReportAccessibleRef.current still remains true, and its value does not change despite the fact that the report's state has been modified.

Previously, we did not set the value to false in the case where the condition if (!report || !report.reportID || shouldHideReport) returned true. Realizing this, I understood that we could fix this error in a more convenient and understandable way by leaving the implementation of shouldShowNotFoundPage untouched. To correct the incorrect state of wasReportAccessibleRef, we simply need to set wasReportAccessibleRef.current = false when it passes the check, like this:

useEffect(() => {
    if (!report || !report.reportID || shouldHideReport) {
        wasReportAccessibleRef.current = false;
        return;
    }
    wasReportAccessibleRef.current = true;
}, [shouldHideReport, report]);

Now, this adjustment ensures that the wasReportAccessibleRef state is correctly updated based on the conditions, addressing the issue you identified.

@dukenv0307
Copy link
Contributor

@parasharrajat I just updated my proposal

@dylanexpensify
Copy link
Contributor

@parasharrajat can you re-review?

@aimane-chnaif
Copy link
Contributor

Taking this over

@parasharrajat
Copy link
Member

@aimane-chnaif will be helping here as C+ while I am unavailable.

@parasharrajat parasharrajat removed their assignment Feb 8, 2024
Copy link

melvin-bot bot commented Feb 10, 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 Feb 12, 2024
@aimane-chnaif
Copy link
Contributor

Announce room should be archived

The expected result is wrong. It should be not found page.

@dylanexpensify can you please check? And assign me here.

@aimane-chnaif
Copy link
Contributor

@dukenv0307 I am confused about your RCA and solution which made things unnecessarily complex. You meant to show loading indicator instead of not found page?

@aimane-chnaif
Copy link
Contributor

I agree with @Amoralchik's proposal. The RCA is correct and solution just fixes that root cause.

@dukenv0307
Copy link
Contributor

You meant to show loading indicator instead of not found page?

@aimane-chnaif No. I mean that we should show not found page in this case

@dukenv0307
Copy link
Contributor

@aimane-chnaif The solution #35751 (comment) need to make sure that it does not lead to the regression here

@aimane-chnaif
Copy link
Contributor

Thanks. I already tested various cases with that solution but not found issue.
@Amoralchik please confirm that solution doesn't cause such regressions like "not found page briefly shows".

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Feb 14, 2024
@dylanexpensify
Copy link
Contributor

NICE!

@dylanexpensify
Copy link
Contributor

Woot! Merged!

@Amoralchik
Copy link
Contributor

The pull request has been reviewed, merged, and deployed. However, it is still labeled as "Reviewing." Is this correct?

@Amoralchik
Copy link
Contributor

The pull request has been reviewed, merged, and deployed. However, it is still labeled as "Reviewing." Is this correct?

mention @dylanexpensify @MonilBhavsar

@aimane-chnaif
Copy link
Contributor

PR was deployed to production on Feb 26

@dylanexpensify dylanexpensify removed the Reviewing Has a PR in review label Mar 6, 2024
@dylanexpensify
Copy link
Contributor

ah apologies, I've been out sick, but yes agree will work on payout

@dylanexpensify
Copy link
Contributor

Payment summary:

Please apply or request!

@dylanexpensify dylanexpensify added Daily KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Mar 13, 2024
@aimane-chnaif
Copy link
Contributor

Accepted this offer already

@Amoralchik
Copy link
Contributor

I already applied to the Upwork job

@melvin-bot melvin-bot bot added the Overdue label Mar 15, 2024
Copy link

melvin-bot bot commented Mar 18, 2024

@Amoralchik, @MonilBhavsar, @dylanexpensify, @aimane-chnaif Eep! 4 days overdue now. Issues have feelings too...

@Amoralchik
Copy link
Contributor

@dylanexpensify
Hey, I noticed the Upwork job posting is no longer available and my application wasn't accepted. Perhaps I should have asked about an offer? I also wanted to clarify that I meant to say that I had "submitted a proposal" for the job. I apologize if my previous message caused any confusion or misunderstanding.

@melvin-bot melvin-bot bot removed the Overdue label Mar 18, 2024
@dylanexpensify
Copy link
Contributor

Ahh I see! Let me get a new link @Amoralchik!

@dylanexpensify
Copy link
Contributor

@Amoralchik sent offer again!

@dylanexpensify
Copy link
Contributor

Done!

@Amoralchik
Copy link
Contributor

@dylanexpensify Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Archived in project
Development

No branches or pull requests

7 participants