Component doesn't rerender when prop changes
I have the component below:
and another component that returns this, but this component doesn't rerender when the given path changes. It reacts to the change in the props, logging it out in the createEffect callback, but it doesn't rerun the createResource part. I was expecting it to rerender completely whenever the given prop changes. How would I solve this? And unfortunately I can't make the path prop a signal, it has to be a string.
7 Replies
and this is one of the components using it
the pathStore is an atom store from nanostores
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
You can just make props.path the source of your resource I think
Refreshing the entire component isn't really possible in solid, anything that changes in your component needs to be reactive
This will re execute when the path updates
This didnt work either, this was the first thing I tried
Can you show the code that didn't work?
The program is having some problems rn, will do in a minute
ahh I see, I forgot it needs to be an arrow function
thank you so much, that solved it
Yep, basically it's so that getter is called within the resource so it can be tracked by it
I get it now, thanks