-
Notifications
You must be signed in to change notification settings - Fork 3
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
[POC] feat: migrate to Broadcast Channel API #600
base: main
Are you sure you want to change the base?
Conversation
This should not be the default, right? Most events will still be local to the tab. Do we need a second emit for these cross-tab events? |
This comment was marked as resolved.
This comment was marked as resolved.
cc @ShGKme |
For some events the context is local. E.g. for a sidebar opened event. |
It seems that most (or just many) of events are local. Even with global events, it may not work globally, depending on a local data. (mentioned in the PR as complex data issue). Or the opposite. It works globally, but each tab emits the event, like
Examples are very "pseudo", but it is very related on the usage. |
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.
🚀🚀🚀
I think, using the Broadcast channel is a great option, that may improve many things in UX and performance / load.
In some cases moving to a "global" approach would probably require also a data sync or moving some modules to a Shared Worker or Web Locks API to implement Leader pattern. And this update in the event hub is a great start to change the way we work with updates in many apps, and to make it uniformly.
Looking forward for this update 🚀
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
2c1f52f
to
a65c5e3
Compare
This is a first DIRTY try to support cross-tab event sharing.
Here you can see it work in action (see the favorites list in the navigation):
Peek.27-04-2023.14-42.mp4
Refs
Issues:
e.g. I was emitting a
files:legacy-view:initialized
withthis
as data, and thetry...catch
didn't prevent it from failing. You will get afailed to execute 'postMessage' on 'BroadcastChannel'
@ChristophWurst @nickvergessen @juliushaertl (feel free to loop anyone you'd like to discuss this)