You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But how can data be loaded for the other case, when a route path is not matched by any route? As far as I can see, only lazy client-side fetching in a useEffect() hook would be possible, but that means nothing meaningful can be rendered on the server-side in case some async data is required. Or am I missing something?
Additionally client-side fetching could indicate an incorrect server response status code. Let’s assume the data I need to fetch for the not-found page cannot be fetched due to some other errors. In that case I want to respond with status code 500 instead of 404, but therefore the data has to be fetched on the server instead of the client.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
When a not-found error is thrown programmatically via
throw notFound()
utility it is quite easy to pass loader data to the not-found component.But how can data be loaded for the other case, when a route path is not matched by any route? As far as I can see, only lazy client-side fetching in a
useEffect()
hook would be possible, but that means nothing meaningful can be rendered on the server-side in case some async data is required. Or am I missing something?Additionally client-side fetching could indicate an incorrect server response status code. Let’s assume the data I need to fetch for the not-found page cannot be fetched due to some other errors. In that case I want to respond with status code
500
instead of404
, but therefore the data has to be fetched on the server instead of the client.Beta Was this translation helpful? Give feedback.
All reactions