SolidJSS
SolidJSโ€ข15mo ago
kfap

mutate & refetch not causing a re render

const [mainParentFolder] = createResource(folderPath, get_os_folder_by_path);

  const [osVideos, { mutate }] = createResource(
    () => mainParentFolder() ? mainParentFolder()?.path : null,
    get_os_videos
  );

onClick={() => {
   let newVideo = structuredClone(video);
   newVideo.watched = !video.watched;

   update_os_videos([newVideo]).then(() => {
      mutate((videos) => {
           return videos?.map((vid) => vid.path === newVideo.path ? newVideo : vid) || [];
       });
   });
}}      


I tried using both refetch & mutate and they both don't re-render. The video does get updated too when I reload the page its correct
Was this page helpful?