Browser refresh -> state loss #183
Unanswered
joelwiesmann
asked this question in
Q&A
Replies: 2 comments 4 replies
-
I have noticed the user session is reset on each browser refresh. I haven't found a way to save the session id in a cookie to preserve it. A This would allow us to implement a mechanism that would work in this way. It's a prototype, a robust session mechanism could be build over it. session_store = {}
def page_open(state, session):
if 'session' not in session['cookies']:
state.set_cookie('session', uuid.uuid4().hex)
else:
session_id = session['cookies']['session']
user_session = session_store[session_id]
if 'image' in user_session:
state["image"] = user_session['image']
def click_img(state, context, session):
session_id = session['cookies']['session']
user_session = session_store[session_id]
user_session['image'] = context['item']
state["image"] = context['item'] Maybe @ramedina86 has a way to handle this sort of usecase. |
Beta Was this translation helpful? Give feedback.
3 replies
-
is there any way to store data on the user / browser side yet? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all
I'm creating a small multipage Streamsync application.
0. (root) state is initalized with empty hash value, user is forwarded on login page
What I observed now is, that the user, once successfully on the control page, looses the state, if he refreshes the browser page. It seems like the user gets the initial_state assigned again. I verified this by putting a print statement in the main.py which shows up twice - once when the user initially access the application, and a second time, when the control page is refreshed.
My environment is Windows and I tried to run the application using the streamsync edit & run commands. Both seem to behave the same.
Anyone has an idea why I'm loosing the users session or how I can debug this further?
Beta Was this translation helpful? Give feedback.
All reactions