Skip to content

error and fallback pages for init() hook #13333

@lumosminima

Description

@lumosminima

Describe the problem

I need to fetch my db before any single bit of my SvelteKit SPA can load, I currently use init() insidie hooks.client.ts but errors invoked using kit's error() aren't presented in either +error.svelte or error.html

Describe the proposed solution

I would like an optional fallback (while init() is awaited) and error page (when init() throws), ideally with our css files loaded (for styling). Currently, if there is an error a white screen is presented with no indication of what went wrong which is confusing to users.

Alternatives considered

Use root layouts for initial stuff but in my experience this has been clunky for init() stuff that needs to load once and requires extra conditional logic and I need separation of concerns. If there are other ways that I can handle this that I haven't considered or am not aware of do share!

Importance

would make my life easier

Additional Information

Router Mode: #hash
Adapter adapter-static

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions