-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix ActiveClientManager doesn't track the currently active tab well and needs improved #40997
Conversation
@DylanDylann Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
@allroundexperts Will you take over this one? |
@allroundexperts I did, bot has changed the comment text, but the job is still in a failed state. Not sure how to fix it. Tried the |
OK, looks like I got the CLA test to pass. You'll need to run prettier on the branch to clear up the ESLint test that is failing. |
Fixed linting |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeScreen.Recording.2024-04-30.at.2.07.24.AM.moviOS: NativeiOS: mWeb SafariScreen.Recording.2024-04-30.at.2.05.13.AM.movMacOS: Chrome / SafariScreen.Recording.2024-04-30.at.1.59.11.AM.movMacOS: Desktop |
Hi @Skakruk!
Can you please explain why the above was not sufficient? |
Also, using |
@allroundexperts sure, here is my thoughts: First, I implemented as I described in the proposal, and everything was working. But I dug deeper in docs and found out that using event The recommended events are But since those event callbacks are sync, it's not guaranteed that that transaction to IDB will finish in time (in almost all tries it didn't). So I had to manage it is some way, that the closing tab will communicate with the left ones and notify them of client being destroyed in sync way. There are a couple of ways to archive it:
I went with localStorage option since it's working in all browsers. I can go with Broadcast Channel API, but I couldn't find any drawbacks of using |
@allroundexperts |
I think I am following most of your solution here. I understand most of the thought process that you went through, but I'm a little unsure about this:
Onyx is already firing a storage event for any data changes here: https://github.com/Expensify/react-native-onyx/blob/main/lib/storage/InstanceSync/index.web.ts#L18 Are you saying that this code never executes before the
I kind of think that we should just go back to this for now. Until there is a specific problem with that approach, let's just stick with it since it is more simple. Once those events are fully deprecated, then we can come back to this and change it if we need to. |
Onyx does its job correctly, but it does not save changes to IndexedDB, since those calls are async.
I'm afraid that using |
Have you confirmed this is an actual problem? |
@tgolen I rechecked and could not observe the issues described in article about bfcache. So I reverting the implementation to the basic one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonderful, thanks for confirming that! This looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me as well!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/tgolen in version: 1.4.73-0 🚀
|
This PR is failing because of issue #40044 The issue is reproducible in: Web - only check for now 1715596548809.40997_web.mp4 |
🚀 Deployed to production by https://github.com/Beamanator in version: 1.4.73-7 🚀
|
Details
Fixed Issues
$ #40044
PROPOSAL: #40044 (comment)
Tests
The easiest way to track if app client is a leader is to check the login page.
Client receives leading status:
Another login page is open.
text appears instead of the login formAnother login page is open.
disappears and the normal login form is shown.Client correctly receives leading status on tab change:
Offline tests
Not applicable.
QA Steps
The easiest way to track if app client is a leader is to check the login page.
Client receives leading status:
Another login page is open.
text appears instead of the login formAnother login page is open.
disappears and the normal login form is shown.Client correctly receives leading status on tab change:
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Not applicable
Android: mWeb Chrome
Not applicable
iOS: Native
Not applicable
iOS: mWeb Safari
Not applicable
MacOS: Chrome / Safari
Screen.Recording.2024-04-25.at.19.15.32.mp4
MacOS: Desktop
Not applicable