-
I'm not entirely sure if this is a bug or my implementation is mistaken. Here's what my code looks like: // src/hooks.ts
export const handle: Handle = async ({ event, resolve }) => {
if (shouldRedirect) {
return Response.redirect(`${event.url.origin}/some-route`, 307);
} else {
return await resolve(event);
}
}; When I run
Then, running The code above was working fine up until Code works as expected when Edit — Here's a repro: https://stackblitz.com/edit/sveltejs-kit-template-default-bbeykp?file=src%2Froutes%2F%2Bpage.js&file=src%2Fhooks.js&terminal=dev |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
After further investigation I was able to solve the issue by disabling prerender in I'm not sure if there's a way to disable prerendering for specific conditions in |
Beta Was this translation helpful? Give feedback.
-
@tcc-sejohnson can you confirm if this is the expected behavior or should I open an issue? |
Beta Was this translation helpful? Give feedback.
After further investigation I was able to solve the issue by disabling prerender in
svelte.config.js
globally.I'm not sure if there's a way to disable prerendering for specific conditions in
hooks.ts
but disabling it globally works in my case.