GenieFramework / Stipple.jl

The reactive UI library for interactive data applications with pure Julia.
MIT License
324 stars 27 forks source link

Sessions are linked together #265

Closed narawat closed 8 months ago

narawat commented 8 months ago

Hello, I'm trying to build web app with multiple app modules similar to this Genie tutorial: https://learn.genieframework.com/docs/guides/adding-reactive-pages#multiple-app-modules

However, sessions seem to be linked together if multiple user open the same route. To confirm, I tried the above Genie example without any modification. https://github.com/narawat/Ai_playground/blob/master/Screenshot%20from%202024-03-09%2017-12-47.png

The result is the same. I test with Firefox and Edge in private windows. https://github.com/narawat/Ai_playground/blob/master/Peek%202024-03-09%2015-28.gif

Package versions: Julia v1.10.2 GenieFramework v2.1.0

Is this normal behavior?

essenciary commented 8 months ago

I think I've seen this issue before - passing the model explicitly I think is problematic at this point. Maybe @PGimenez or @hhaensel can chime in.

My recommendation is: move the @page macros into each of their respective modules and remove the model= part. Does that fix it?

narawat commented 8 months ago

Thanks essenciary. Happy to report that your suggest works!. I also make the docs PR.

hhaensel commented 8 months ago

I think we shouldn't close this, but rather fix it. I'll have a look where the issue comes from.

hhaensel commented 8 months ago

Just added a potential fix for the issue. @narawat could you try your original version with the hh-multipage-fix branch?

You can switch to that branch by entering

pkg> add Stipple#hh-multipage-fix

in the package manager.

narawat commented 8 months ago

The example works as it should now. Thanks. Btw, Is it possible to use async MQTT client (MQTTClient.jl) inside a module? I'm would like to connect a reactive control dashboard to MQTT-based services to monitor/manage/control IoT devices. I think Genie have great potential in this area too.

hhaensel commented 8 months ago

Thanks a lot for checking! I'll add tests for this issue and will merge soon.

Concerning MQTT I remember that we had an issue in the past. I propose that you build a MWE and open a new issue with that. Let's see whether we can help you.

hhaensel commented 8 months ago

Here's a Genie issue containing a MWE. Didn't read through it yet, though. https://github.com/GenieFramework/Genie.jl/issues/702