spy16 / sukit

Supabase + SvelteKit SaaS template.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: /dashboard gets pre-rendered with hardcoded redirect to /auth

spy16 opened this issue · comments

/dashboard is a private route (under route group (private)).

  • (private) route group has a +layout.ts with prerender=false
  • (public) route group has a +layout.ts with prerender=true

The home page which is a public route has a a tag to /dashboard (part of private group). Due to this, during build, it seems that SvelteKit is preloading /dashboard and pre-rendering it. The final build has a dashboard.html file with just this:

<script>location.href="/auth";</script><meta http-equiv="refresh" content="0;url=/auth">

If I remove the <a href="/dashboard">Get Started</a> from the home-page then, this does not happen and everything works as expected.

Remove :
data-sveltekit-preload-data="hover"
from app.html and add
(private) / dashboard / +page.server.ts
export const prerender = false; -- add this to +page.server.ts