这是indexloc提供的服务,不要输入任何密码
Skip to content

fix(logout): should work correctly with multiple tabs (release) #1435

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

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

wermanoid
Copy link
Contributor

Before this PR

If you have allowMultiTabLogin and you have few tabs opened, you can face issue with logout function.

As I found, after logout there are still couple of messages sent from client to serwiceWorker (init and setState, at least).
This leads to case, when currentDatabase.state is changed after you passed logout function, but before you get redirected back to login screen. (At lease I think this is a reason. If you have better ideas about how to fix this - please comment, this is interesting).

So when you try to login after logout, you receive 400 error from OAuth2 server, because client sends request with some data from previous session (which was closed obviously).

After this PR

You can loggin back to app from any tab without errors

@@ -72,23 +84,13 @@ const sendMessageAsync =
messageChannel.port1.close();
messageChannel.port2.close();
};
registration.active.postMessage(data, [messageChannel.port2]);
registration.active.postMessage({ ...data, tabId: getTabId(data.configurationName) }, [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was very annoying that some actions has tabId and some are missing. I decided to unify this piece, so any interaction between client(s)/serviceWorker will hold ID for identification which tab performs specific action

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @wermanoid , very sorry for the delay. I am in holidays :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can publish it as an alpha if you want ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, let's do it :)

thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Published as an alpha @wermanoid thank you !

@guillaume-chervet guillaume-chervet merged commit 1159262 into AxaFrance:main Aug 13, 2024
13 checks passed
@wermanoid wermanoid deleted the fix/multitab-logout branch August 14, 2024 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants