SolidJSS
SolidJS2y ago
103 replies
HashtagOctothorp

How to refetch a "use server" function / RPC?

I've created a server function that I can confirm works as expected, now I'm trying to figure out how to "correctly" re-run this function on a timed interval.

Using the documentation (https://start.solidjs.com/core-concepts/data-loading), it first mentions createResource() for requests, which makes sense since it comes with a mutate and refetch function. Then it goes on to give a "Data loading always on the server" example, now moving to createAsync and cache (both /router imports), but from my attempts to use those examples, they work for initial page load but do not appear to contain mechanisms for re-running the server function and updating the UI accordingly. Additionally, the example listed above doesn't seem to actually run anything async (there's no await in that async server function), so I'm wondering if maybe the example is still missing something (like when is the route object used?! Is it a magic object / used somehow when exported from a page? Not listed in API Routes tab).

Am I missing something?
Thanks!

(Code examples in thread)
SolidStart Beta Documentation
Early release documentation and resources for SolidStart Beta
SolidStart Beta Documentation
Was this page helpful?