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
If an error occurs on the prefetching of the route data, the user is redirected back to the previous page even though the URL in the browser shows the user landing at the destination.
For example,
User is at ?page=1
User navigates to ?page=2 but gets an error
?page=2 remains in the browser window but data from ?page=1 gets displayed again
Expected behavior 🤔
User should land on the target route (and that target page's error handling will take over)
Steps to reproduce 🕹
Steps:
Create a simple route prefetch that throws an error: export const route = { preload({ location, params }) { if(params.page == 2){ throw('Testing this'); } } } satisfies RouteDefinition;
Load the app on a page that will not error
Click a link that triggers navigation to the error prone route
Context 🔦
I am testing out my error messaging and ensuring my components are displaying that an error exists. Note: wrapping the prefetch in a try/catch gets me around the problem but I think I shouldn't have to do this.
Your environment 🌎
No response
The text was updated successfully, but these errors were encountered:
I'm going to ask for a reproduction. I'd expect ErrorBoundary to be able to catch this. Albeit happening during routing it will be one up by the router. If it is not being caught by an ErrorBoundary then we have an issue. Also preload function may load on a preload event like a hover or as we enter the route, these impact how they error. I suppose a sync error might be handled differently than an async one which may be the source of the issue.
Duplicates
Latest version
Current behavior 😯
If an error occurs on the prefetching of the route data, the user is redirected back to the previous page even though the URL in the browser shows the user landing at the destination.
For example,
?page=1
?page=2
but gets an error?page=2
remains in the browser window but data from?page=1
gets displayed againExpected behavior 🤔
User should land on the target route (and that target page's error handling will take over)
Steps to reproduce 🕹
Steps:
export const route = { preload({ location, params }) { if(params.page == 2){ throw('Testing this'); } } } satisfies RouteDefinition;
Context 🔦
I am testing out my error messaging and ensuring my components are displaying that an error exists. Note: wrapping the prefetch in a try/catch gets me around the problem but I think I shouldn't have to do this.
Your environment 🌎
No response
The text was updated successfully, but these errors were encountered: