Hi Softr team & community,
I’m building a customer portal with a “company switcher” for internal users and running into a caching/refresh issue I can’t solve reliably.
Setup:
I have two Softr tables — “persons” (synced with users) and “companies”. The persons table has a field called “currentlyselectedcompany” which is a relation to companies. For regular customers, this value is fixed (their own company). For internal users, there’s a dedicated page with a list block showing all companies — they can select one via One-Click-Update, and all other pages filter based on that value. The logic itself works correctly.
Problem:
After an internal user selects a new company, it takes 5–10 seconds for other blocks/pages to reflect the change. Even worse: triggering window.location.href, window.location.reload(), or reload-block-* events via custom JS in the page header has no effect at all. Only a manual F5 reload works reliably.
What I’ve tried:
- window.location.href = ‘/page?t=’ + Date.now() (cache-busting URL)
- window.location.reload() inside update-record-success-BLOCKNAME listener
- Dispatching reload-block-BLOCKNAME custom events after the update
None of these trigger a proper data refetch. It seems like Softr is holding the logged-in user’s data (including currentlyselectedcompany) in a client-side cache that only clears on a hard F5 reload.
Question:
Is there a reliable way to force Softr to refetch all block data from the DB simultaneously? Ideally, right after a One-Click-Update succeeds? Or is there a way to invalidate the logged-in user’s session cache via JS?
Thanks a lot!