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] Onboarding- After finishing "onboarding" and switching to DM, an error appears in the console #40458

Closed
2 of 6 tasks
kbecciv opened this issue Apr 18, 2024 · 23 comments
Closed
2 of 6 tasks
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

@kbecciv
Copy link

kbecciv commented Apr 18, 2024

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: v1.4.63-0
Reproducible in staging?: y
Reproducible in production?: n
Issue reported by: Applause - Internal Team
Issue found when executing PR: #40328

Action Performed:

Prerequisites:
There must be at least one conversation in the account. Enable the console.

Step:

  1. Open https://staging.new.expensify.com/onboarding
  2. Fill in the required data
  3. Click the "Continue" button
  4. Select "Track business spend for taxes"
  5. Click the "Continue" button
  6. Navigate to any existing conversation

Expected Result:

After completing "onboarding" and switching to DM, no errors should appear in the console

Actual Result:

After finishing "onboarding" and switching to DM, an error appears in the console

Workaround:

n/a

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

Bug6453504_1713439454477.Recording__55.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~017d01cb735c28a1cd
  • Upwork Job ID: 1780977474718523392
  • Last Price Increase: 2024-05-02
Issue OwnerCurrent Issue Owner: @mananjadhav
@kbecciv kbecciv added the DeployBlockerCash This issue or pull request should block deployment label Apr 18, 2024
Copy link

melvin-bot bot commented Apr 18, 2024

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

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.

@kbecciv
Copy link
Author

kbecciv commented Apr 18, 2024

We think that this bug might be related to #vip-vsb

@tgolen tgolen added Bug Something is broken. Auto assigns a BugZero manager. and removed DeployBlockerCash This issue or pull request should block deployment labels Apr 18, 2024
Copy link

melvin-bot bot commented Apr 18, 2024

Triggered auto assignment to @greg-schroeder (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.

@tgolen
Copy link
Contributor

tgolen commented Apr 18, 2024

This is not a blocker. Removing the label and sending this to external to investigate a fix.

@tgolen tgolen added the External Added to denote the issue can be worked on by a contributor label Apr 18, 2024
Copy link

melvin-bot bot commented Apr 18, 2024

Job added to Upwork: https://www.upwork.com/jobs/~017d01cb735c28a1cd

@melvin-bot melvin-bot bot changed the title Onboarding- After finishing "onboarding" and switching to DM, an error appears in the console [$250] Onboarding- After finishing "onboarding" and switching to DM, an error appears in the console Apr 18, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 18, 2024
Copy link

melvin-bot bot commented Apr 18, 2024

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

@tgolen tgolen added Daily KSv2 and removed Hourly KSv2 labels Apr 18, 2024
@skyweb331
Copy link
Contributor

skyweb331 commented Apr 18, 2024

Proposal

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

After playing video and changing the room, resetting the VideoPlayerData causes error.

What is the root cause of that problem?

According to the following codes, when the room changes, it will reset the VideoPlayerData by running the following code.

useEffect(() => {
if (!currentReportID) {
return;
}
resetVideoPlayerData();
}, [currentReportID, resetVideoPlayerData]);

const resetVideoPlayerData = useCallback(() => {
videoResumeTryNumber.current = 0;
stopVideo();
setCurrentlyPlayingURL(null);
setSharedElement(null);
setOriginalParent(null);
currentVideoPlayerRef.current = null;
unloadVideo();
}, [stopVideo, unloadVideo]);

And stopVideo function is here

const stopVideo = useCallback(() => {
currentVideoPlayerRef.current?.setStatusAsync?.({shouldPlay: false, positionMillis: 0});
}, [currentVideoPlayerRef]);

Problem is stopVideo and unloadVideo are async functions, so currentVideoPlayerRef.current should not be set as null before releasing functions are finished.

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

After stopVideo and unloadVideo are all finished, currentVideoPlayerRef.current should be set as null

skyweb331@9df23dc

What alternative solutions did you explore? (Optional)

N/A

@bernhardoj
Copy link
Contributor

Proposal

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

The console error shows after closing the onboarding video and switch to another report.

What is the root cause of that problem?

When the video player is mounted, currentVideoPlayerRef will be set to the onboarding video ref. When we close it and switch to another report, we are trying to stop the video (and other things).

useEffect(() => {
if (!currentReportID) {
return;
}
resetVideoPlayerData();
}, [currentReportID, resetVideoPlayerData]);

const resetVideoPlayerData = useCallback(() => {
videoResumeTryNumber.current = 0;
stopVideo();

Because the currentVideoPlayerRef still hold the onboarding video player ref that is already destroyed, we got the console error. I previously fix this console error in my PR here, but looks like the code was removed

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

We need to clear the currentVideoPlayerRef when the video player is unmounted and shouldUseSharedVideoElement is false, basically the same solution I did before.

useEffect(() => {
    shouldUseSharedVideoElementRef.current = shouldUseSharedVideoElement;
}, [shouldUseSharedVideoElement]);

useEffect(
    () => () => {
        if (shouldUseSharedVideoElementRef.current) {
            return;
        }
        // If it's not a shared video player, clear the video player ref.
        currentVideoPlayerRef.current = null;
    },
    [currentVideoPlayerRef],
);

We can even call resetVideoPlayerData so it clears the currentlyPlayingURL so we can remove this code.

const isCurrentlyURLSetRef = useRef<boolean>();
isCurrentlyURLSetRef.current = isCurrentlyURLSet;
useEffect(
() => () => {
if (!isCurrentlyURLSetRef.current) {
return;
}
setCurrentlyPlayingURL(null);
},
[setCurrentlyPlayingURL],
);

@melvin-bot melvin-bot bot added the Overdue label Apr 22, 2024
Copy link

melvin-bot bot commented Apr 23, 2024

@tgolen, @mananjadhav, @greg-schroeder Eep! 4 days overdue now. Issues have feelings too...

@mananjadhav
Copy link
Collaborator

mananjadhav commented Apr 23, 2024

Will review this today.

@melvin-bot melvin-bot bot removed the Overdue label Apr 23, 2024
@tgolen
Copy link
Contributor

tgolen commented Apr 25, 2024

@mananjadhav Can you please take a look at this one soon?

@mananjadhav
Copy link
Collaborator

I looked through the proposals yesterday. I'll test them today and confirm if one of them is good to go.

Copy link

melvin-bot bot commented Apr 25, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@mananjadhav
Copy link
Collaborator

I was checking this and I am unable to reproduce this on staging as well as latest main.

console-error-dm.mov

@bernhardoj
Copy link
Contributor

It's already fixed in #40132

@skyweb331
Copy link
Contributor

skyweb331 commented Apr 26, 2024

This means, this bug is duplicated??? :-(

Copy link

melvin-bot bot commented Apr 29, 2024

@tgolen, @mananjadhav, @greg-schroeder Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot melvin-bot bot added the Overdue label Apr 29, 2024
Copy link

melvin-bot bot commented May 1, 2024

@tgolen, @mananjadhav, @greg-schroeder Eep! 4 days overdue now. Issues have feelings too...

@mananjadhav
Copy link
Collaborator

@kbecciv Can you please confirm if this is still reproducible.

@melvin-bot melvin-bot bot removed the Overdue label May 1, 2024
Copy link

melvin-bot bot commented May 2, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Copy link

melvin-bot bot commented May 2, 2024

@tgolen @mananjadhav @greg-schroeder this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@tgolen
Copy link
Contributor

tgolen commented May 6, 2024

It sounds like this can be closed since it's already fixed. Please reopen if anyone is able to reproduce it.

@tgolen tgolen closed this as completed May 6, 2024
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
None yet
Development

No branches or pull requests

6 participants