SolidJSS
SolidJSโ€ข4mo agoโ€ข
7 replies
Jason.json

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}

 const [employee, { refetch }] = createResource(async () => get_employee(params.id), {
    deferStream: true,
  });


I want to refetch the data when user updates the employee data like so:

<SomeSaveChangesButton
 onClick={
   async () => {
     const response = await fetch(...);
      if (response.ok) {
        refetch();
      }
   } 
  } />


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. ๐Ÿ™
Was this page helpful?