refetch failed resources whenever their sources change?
here's a playground: https://playground.solidjs.com/anonymous/df720f20-833b-420d-af40-f1dc385ceb69
i wrapped the component that imitates data fetching in ErrorBoundary and want the boundary to automatically reset whenever a resource that failed is invalidated
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
4 Replies
How do you intend to invalidate the resource?
by updating its source signal
When it errors and the error boundary renders the fallback. The component which has the error and includes createResource is not present.
ErrorBoundarie’s fallback provides a reset function with which you can use to try to redender the children with errors.
So you could add a createEffect in the ErrorBoundary that picks up the source signal and then calls reset.
As long as the source signal lives outside of the ErrorBoundary
thanks for your help. to be honest, I'm not pleased with the solution, but couldn't come up with anything better except for wrapping the boundary in a keyed Show which looks less messy, but still requires to manually specify resources that are used inside
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template