question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why is redirect not supported from __error.svelte cmpt?

See original GitHub issue

I have a small reproducible example here.

In the __error.svelte cmpt I have thrown in a redirect like this in the load function:

 return {
                status: 302,
                redirect: '/login'
            }

But this is not working. Is this a bug, not allowed - or do I misunderstand something here?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
benmccanncommented, Sep 14, 2021

I talked about this with the rest of the maintainers at today’s maintainer’s meeting. Folks suggested you could already do this in one of a couple ways:

  • for the 404 case, create a [fallthough].svelte that would catch any unhandled routes and redirect there
  • for other cases, do it in handle. (call resolve, check the returned status, and then do a redirect based on that)

There was a consensus that redirecting on error pages is in general a bit of a weird thing to do and so folks didn’t want to add support for it directly into the router, but instead suggested it be handled in these other ways since it’s a relatively uncommon use case

0reactions
PlopTheRealcommented, Jul 6, 2022

Hey I’ve added a [fallthough].svelte but it doesn’t catch 404 form urls with subsequent path: /someInvalidUrl => ok /someInvalidUrl/otherPage => not ok Any ideas to catch all urls that are giving 404s?

Read more comments on GitHub >

github_iconTop Results From Across the Web

SvelteKit: redirect() not working on server without disabling ssr
I found the problem. The culprit was the status code I was using for redirecting. I was providing the wrong status code 300...
Read more >
Redirect wont work : r/sveltejs - Reddit
Having issues in getting a Svelte endpoint to redirect. ... It redirects the fetch route not the website the user is on.
Read more >
Untitled
#Ukmath, Me without you loick essien cover, Linotype fontexplorer x pro mac, ... Heart rate monitor polar not working, Memmen bedeutung, Garmin 3590...
Read more >
the of and to a in for is on s that by this with i you it not
the of and to a in for is on s that by this with i you it not or be are from at...
Read more >
skb - ALBA.Net
Los angeles guitar quartet, Man working hard pictures, Unitary hecke character? ... Kabanata 2 noli me tangere, Heil heat pump not working, Isorno...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found