Help understanding createResource
I have a setup like this (LIVE: https://playground.solidjs.com/anonymous/125ef44e-bee8-4049-b17c-166f6042f962)
I wanted to test out error handling, so I hardcoded a throw in the first request https://playground.solidjs.com/anonymous/121dd55e-bd06-44e9-b36e-ee56585d8ad3
But it doesn't work, and it renders the loading message after it errors out. I tried wrapping it in an error boundary like this, but it still doesn't work, it renders the fallback message, but nothing happens when you click the refetch button https://playground.solidjs.com/anonymous/a29f38e1-9724-43bb-928e-0e7f30ee9f30
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
3 Replies
When using suspense, you need to use the error boundary component, not use the error property of the resource
is what I'm doing in the third example, and it displays the error part correctly, but when the try again button is pressed nothing happens
Once the app is in an error state you need to use the reset callback provided by the errorboundary:
https://docs.solidjs.com/reference/components/error-boundary#lesserrorboundarygreater