-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat(12820): implement crossTab auth events #14465
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
base: main
Are you sure you want to change the base?
Conversation
de72c25 to
1b8a803
Compare
c82b5ab to
e9c1725
Compare
896595b to
ccfd497
Compare
ccfd497 to
6bd538e
Compare
| }); | ||
|
|
||
| describe('setupNotify', () => { | ||
| it('should setup a KeyValueStorageEvent listener', async () => { |
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.
Can we split this into multiple tests? It will make debugging easier in case of failures
|
|
||
| it('should not allow crossTab dispatch in other channels', () => { | ||
| Hub.dispatch( | ||
| // this looks weird but is only used to mute TS. |
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.
🤔
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.
Just one minor comment on one of the tests. Other than that, looks good to me!
Description of changes
Introduce the possibility of listening to crossTab auth events.
The changes introduce a listener for storage events on the DefaultStorage (
window.localStorage) as well as on the SessionStorage (window.sessionStorage)since the logic for adding and removing listeners is on the
KeyValueStorageit is (theoretically) possible in future to add listeners for crossTab events on CookieStorage and CustomStorage.since it listens to all storage events, it then filters the event based on token-naming convention to dispatch crossTab Hub events on the "auth" channel.
the typing and implementation of
dispatchandlistenon the hub makes sure, that only auth-channel events are allowed for crossTab communication.Issue #, if available
Issue 12820
Description of how you validated changes
I added unit-tests and did manual explorative testing.
Checklist
yarn testpassesChecklist for repo maintainers
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.