SolidJSS
SolidJSโ€ข17mo agoโ€ข
6 replies
mihaaai

How to trigger server function for SSR when transitioning routes?

Is there any way to achieve a new SSR call to the backend for each route I navigate() with useNavigate() within a [slug] pattern?

I have a createAsync() in [slug].tsx that is supposed to get some data from the backend based on the route I get to, but it triggers only with a full refresh of the tab in the browser or fisrt page load, if I try to navigate() from inside the app the createAsync() function is not called anymore, it's a "use server" declared function, with a cache() wrapper, just like the examples on docs.

Ideally I wouldn't use <A> components and stick to useNavigate() but I'm open to anything would make this work.

Maybe this is the correct behavior of my setup but I couldn't find anything related to my use-case in the docs
Was this page helpful?