S
SolidJS•9mo ago
jacobgoodwin

Is there any approach to invalidate the back/forward browser cache in solid-router (v 0.12.x)?

I previously asked this question in github discussions before realizing this more-active Discord existed: https://github.com/solidjs/solid-router/discussions/384. I thought maybe somebody here might have run into this issue in recent versions of solid-router in combination with solid-start. Repeated here: I'm working on page which requires an authorized user to manage a list of data. When the user logs out, I redirect them to a login page. However, if I press the back button, the browser back/forward cache takes over, and displays the last page (see point 4 in the cache documentation: https://github.com/solidjs/solid-router/blob/main/src/data/cache.ts#L16). As far as I can tell from the code, this cache lasts 180000 ms. I would prefer that the user is not able to see the content of the page which requires an authorized user. It's not the end of the world, as taking any future action on the authorized data would eventually land them back at a login page (check the request for a user and redirect). But I still don't like the idea of showing that cached data. Is there any mechanism for accomplishing this? Maybe via some client side code and action? This is an example of a layout for a page using solid-start's FileRouter. I've tried playing around with the load function, but am struggling to figure this out. https://github.com/JacobSNGoodwin/scavenge-solid/blob/errors-loging/src/routes/manage.tsx
GitHub
scavenge-solid/src/routes/manage.tsx at errors-loging · JacobSNGood...
A playground for managing scavenger hunts build with solid-start > 0.4 - JacobSNGoodwin/scavenge-solid
GitHub
solid-router/src/data/cache.ts at main · solidjs/solid-router
A universal router for Solid inspired by Ember and React Router - solidjs/solid-router
1 Reply
jacobgoodwin
jacobgoodwinOP•9mo ago
I'll note that a much easier example is solid-start's own with-auth example, where you can log out, and the click the browser back button to show the page. I've tried some some cache header controls and some client-side workarounds. I had no luck with the former, and the latter will always show the page momentarily before reloading the page. This was answered in solid-router discussions as is considered a bug. I'll chill the hell out. 🙂
Want results from more Discord servers?
Add your server