RandomCatLover Claude Sonnet 5 commited on
Commit
5be8e7e
·
1 Parent(s): 2f83d3e

Fix CachedWidgetWarning: don't cache the CookieManager component

Browse files

st.cache_resource froze the component after its first render, so
cookie reads/writes never reflected later changes. Fixed by
constructing exactly one CookieManager per script run in app.py and
threading it into cookie_token_store's functions as a parameter,
rather than each function lazily constructing (and risking a second,
same-keyed) instance internally -- calling
stx.CookieManager(key=...) twice in one run raises DuplicateWidgetID.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

2 files changed +30 -20
Files changed (2)
app.py+12-9
src/cookie_token_store.py+18-11