Custom JS block reload after One-Click-Update not working reliably: user session cache issue?

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!

I came across this older discussion and wanted to add a suggestion. Have you tried using JavaScript to detect the company switch event and then trigger a fetch request for the updated data? This way, you might bypass the need for a manual F5 refresh. Also, double-check your cache settings in the browser — perhaps adjusting them could help with the refresh lag.

Found this while browsing and thought it might help to check if Softr has introduced any new updates since your post. Sometimes, changes on their end can unexpectedly solve these issues. Also, have you tried reaching out to their support directly for any undocumented solutions? Maybe the community has found tweaks or workarounds since the original discussion. Let’s get this conversation going again!