feusanc
feusanc
Explore posts from servers
SSolidJS
Created by feusanc on 8/5/2023 in #support
Component doesn't rerender when prop changes
I get it now, thanks
16 replies
SSolidJS
Created by feusanc on 8/5/2023 in #support
Component doesn't rerender when prop changes
thank you so much, that solved it
16 replies
SSolidJS
Created by feusanc on 8/5/2023 in #support
Component doesn't rerender when prop changes
ahh I see, I forgot it needs to be an arrow function
16 replies
SSolidJS
Created by feusanc on 8/5/2023 in #support
Component doesn't rerender when prop changes
const [contents] = createResource(props.path, (path) =>
fetch_directory(path)
);

return (
<>
<Switch>
<Match when={contents.loading}>
<div>Loading...</div>
</Match>
<Match when={contents.error}>
<div>Error: {contents.error}</div>
</Match>
<Match when={contents()}>
<For each={contents()}>
{(content) => (
<Switch>
<Match when={content.type === "directory"}>
<Directory file={content} />
</Match>
<Match when={content.type}>
<File file={content} />
</Match>
</Switch>
)}
</For>
</Match>
</Switch>
</>
);
const [contents] = createResource(props.path, (path) =>
fetch_directory(path)
);

return (
<>
<Switch>
<Match when={contents.loading}>
<div>Loading...</div>
</Match>
<Match when={contents.error}>
<div>Error: {contents.error}</div>
</Match>
<Match when={contents()}>
<For each={contents()}>
{(content) => (
<Switch>
<Match when={content.type === "directory"}>
<Directory file={content} />
</Match>
<Match when={content.type}>
<File file={content} />
</Match>
</Switch>
)}
</For>
</Match>
</Switch>
</>
);
16 replies
SSolidJS
Created by feusanc on 8/5/2023 in #support
Component doesn't rerender when prop changes
The program is having some problems rn, will do in a minute
16 replies
SSolidJS
Created by feusanc on 8/5/2023 in #support
Component doesn't rerender when prop changes
This didnt work either, this was the first thing I tried
16 replies
SSolidJS
Created by feusanc on 8/5/2023 in #support
Component doesn't rerender when prop changes
createEffect(() => {
console.log(props.path);
refetch();
});
createEffect(() => {
console.log(props.path);
refetch();
});
with this "trick" I can cause it to refetch and thus rerender, but it only rerenders that depend on the content, I want the whole component to refresh
16 replies
SSolidJS
Created by feusanc on 8/5/2023 in #support
Component doesn't rerender when prop changes
the pathStore is an atom store from nanostores
16 replies
SSolidJS
Created by feusanc on 8/5/2023 in #support
Component doesn't rerender when prop changes
export default function FileViewer() {
const path = useStore(pathStore);

return (
<div class="ml-1">
<p>{path()}</p>
<Show when={path()}>
<FolderContents path={path()} />
</Show>
</div>
);
}
export default function FileViewer() {
const path = useStore(pathStore);

return (
<div class="ml-1">
<p>{path()}</p>
<Show when={path()}>
<FolderContents path={path()} />
</Show>
</div>
);
}
and this is one of the components using it
16 replies