mayu-live / framework

Mayu is a live updating server-side component-based VDOM rendering framework written in Ruby
https://mayu.live
GNU Affero General Public License v3.0
130 stars 4 forks source link

Share sessions between tabs #7

Open aalin opened 1 year ago

aalin commented 1 year ago

Lets say a visitor opens a page in two tabs (https://mayu.live/counter for example), it would be pretty awesome if they could have the exact same state in the two tabs... and if they click on another page in one tab, they would still be on the counter-page in the other, and if they return to the counter-page in the first tab, they would see the same state in both tabs again...

I don't know exactly how that would work, both browser tabs would have to share the exact same VTree, but they would have different routes...

If a visitor has multiple tabs with different paths and maybe some tabs with the same tab, it would be possible to render the page once for each route, and sync that data... but the whole diffing-thing would have to be remade, because each tab would have to have it's own tree to diff with the new tree... Tricky stuff, but I think maybe by writing it somewhere I will think about it and maybe figure out how to do it at some point...

I think it would be possible to do, and I think it would be a pretty good feature... It would somehow have to be able to reuse components while rendering the same tree... A lot of the VDOM-logic would probably have to be rewritten...