Should non-200 client-side navigations result in a page reload?
See original GitHub issueIf a page errors during SSR…
<script context="module">
export function preload() {
this.error(500, 'nope');
}
</script>
…then the resulting error page is served with the appropriate status code. The same goes for 404s.
But if you navigate client-side from a page that renders ok (/good
) to one that doesn’t (/bad
), you don’t get an error status code because as far as the browser is concerned you’re not actually navigating.
Remix has an interesting take on this — they actually abort the client-side transition and reload /bad
. Is this feature useful? It doesn’t seem particularly useful to me, but they seem quite excited about it so probably know something I don’t.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
React-router URLs don't work when refreshing or writing ...
The historyApiFallback is what fixed this issue for me. Now routing works correctly and I can refresh the page or type in the...
Read more >I don't get client side navigation. It's a worse experience in ...
Because it's faster. If you don't have to download all the content again, force the browser to re-render everything, then by design you...
Read more >Handling SPA Fallback Paths in a Generic ASP.NET Core ...
This works just fine - as long as the user stays within the application and doesn't hard refresh the page. IOW, clicking through...
Read more >Refreshing Server-Side Props - Next.js - Josh W Comeau
js to re-fetch the data, on demand, without doing a hard refresh of the whole page? In this short tutorial, I'll share the...
Read more >Next JS Export to static HTML always redirect to home page ...
Test it on development mode yarn dev and visit the links and refresh each page. It will not redirect to / page. Build...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This should possibly be a separate issue, but I do think that there should be a better way to deal with errors when rendering pages (whether on the server or on the client), so you can send them off to some logging service or whatever you want to do. Right now, Sapper is pretty greedy about swallowing errors, and it’s tricky to set something like this up.
A handler like this might also be a good place for someone to implement their own page reload, if that’s something they happened to want.
Hmm, having the page reload seems like an unexpected behavior to me and it’s probably not what I’d want unless it provides some benefit I’m not thinking of. I’d be curious what the motivation for that feature in Remix is.