Skip to content

Commit d2e2246

Browse files
committed
fix: clear cache on page refresh
1 parent 7b4d688 commit d2e2246

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

testgen/ui/navigation/router.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ def run(self) -> None:
3030

3131
current_page = st.navigation(streamlit_pages, position="hidden")
3232

33+
if not session.initialized:
34+
# Clear cache on initial load or page refresh
35+
st.cache_data.clear()
36+
session.initialized = True
37+
3338
# This hack is needed because the auth cookie is not set if navigation happens immediately after login
3439
# We have to navigate on the next run
3540
if session.auth.logging_in:

testgen/ui/session.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class TestgenSession(Singleton):
2323
# streamlit_authenticator sets this attribute implicitly
2424
authentication_status: bool
2525

26+
initialized: bool
2627
page_pending_cookies: st.Page # type: ignore
2728
page_pending_login: str
2829
page_args_pending_login: dict

0 commit comments

Comments
 (0)