widgetti / solara

A Pure Python, React-style Framework for Scaling Your Jupyter and Web Apps
https://solara.dev
MIT License
1.91k stars 141 forks source link

Reactive states transferring between users, when multiple users are concurrently accessing them. #867

Open daoslies opened 2 days ago

daoslies commented 2 days ago

We're building an app with solara that involves querying a database and presenting that information to the user.

We have noticed that in a number of places where we're using reactive states ( state = solara.reactive() ), there is an intermittent issue where users on different machines will be presented with the information from a different user's reactive state.

e.g. A user does a search, the result of that search is saved to a reactive state, a different user on a different machine will end up with that search result.

We noticed it initially when using reactive states to identify users with a username - someone would open up the app, and be presented with someone else's username.


With solara.use_state() you can enter a key='x' as an argument, and we do not get the issue with use_states because of that, as we can assign a unique key to each user. So there is definitely a unique state for each user and they don't end up interacting.

I think that if we could do that with solara.reactive() as well, that would enable us to resolve the issue. (but I'm not 100% sure how solara.reactive() works under the hood, so am unsure if this is possible.)


If you need any more details or there is anything else we can do to help resolve this issue please do let us know - we are quite deep into this project and this issue does not appear to be something we can easily resolve on our own. (except by changing everything to use_states, and that's not really ideal because of the limitations of use_states)

Fully holding out for the possibility that we are simply using solara.reactive() in an unexpected way, but we have been using solara for 6 months now and are fairly familiar with the way solara wants to be used.

Thankyou very much and all the best.