-
Notifications
You must be signed in to change notification settings - Fork 493
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
add global context for session #2934
Conversation
Thanks for your PR! I've been wondering if your solution is the same as https://flet.dev/docs/guides/python/session-storage/ ? |
No. My solution allows you to access the session without accessing the page variable. I solved the problem when I had to throw the page variable everywhere to access the session. Now you just need to |
For example, my application uses the langchain library, which has a huge pile of tools and now instead of throwing a page variable into each tool I can just import flet and access flet.context.page from any tool. |
OK, interesting. Never used context vars before - time to learn! :) |
@50Bytes-dev, will you mind documenting this addition somewhere in the flet-docs? :) |
I have no idea how best to do it and in what location. It would be easier for you to do it |
🆒 |
* add global context for session * export context
* add global context for session * export context
I was inspired by streamlit library, it has session_state, which is very convenient for me. I made something similar.