S
SolidJS2mo 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
);
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) || [];
});
});
}}
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
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server