Solid Start create resource refetch issue
Hi I am looking for a solution to force refetch the resource provided below.
I used
{ refetch }
method and it works sometimes idk why.
My temporary solution is to fetch new data is just by using window.location.reload()
.
example route: /employees/{id: UUID}
I want to refetch the data when user updates the employee data like so:
I think it does not refetch the data due to constant id
from url path.
If somone here know a right solution I would be greateful. 🙏3 Replies
Not sure if this is the issue but maybe you can try to pass params.id to get_employee by the source argument in createResource instead if it's not reactive.
https://docs.solidjs.com/reference/basic-reactivity/create-resource#the-fetcher
createResource - Solid Docs
Documentation for SolidJS, the signals-powered UI framework
Actually I tested and it should still work in your way. Do you mind share a bit more code?
By your code logic, is it not refetching even when response.ok is true?
All fixed
The issue was that the
params.id
was not reactive at all.
my solution:
thx man for help! 👍