KyleJune / deno-tailwind-ui-react-example

An example of how you can use Tailwind UI and React with Deno
20 stars 5 forks source link

Display errors when visiting a post url that is invalid #24

Open KyleJune opened 2 years ago

KyleJune commented 2 years ago

Currently if you click the invalid or negative post links with javascript disabled, it will return an internal server error. That's because error boundaries do not work on the server which results in the error going unhandled. The page should render like it would if navigating to the page from within the browser and the try again link should refresh the page when javascript is disabled.

KyleJune commented 2 years ago

I found the following in react-query ssr documentation. It sounds like I may need to use queryClient.fetchQuery instead of useQuery to be able to handle the errors on the server without using the error boundary. If there is a way to use the error boundary I would doing that to keep the code simple.

https://react-query.tanstack.com/guides/ssr#only-successful-queries-are-included-in-dehydration