1.4 KiB
1.4 KiB
Data Model: SvelteKit Integration
Entities
Route
Represents a navigable URL in the application.
| Field | Type | Description |
|---|---|---|
path |
String | The URL path (e.g., /, /settings) |
component |
Svelte Component | The page component to render |
data_requirements |
List | Backend data needed for this route |
layout |
Layout | The layout wrapping this route |
Validation Rules:
pathmust be unique.pathmust follow SvelteKit file-based routing conventions.
Layout
Represents a shared UI structure.
| Field | Type | Description |
|---|---|---|
name |
String | Identifier for the layout (e.g., default) |
components |
List | Shared components (Header, Footer, Sidebar) |
slot |
Placeholder | Where the route content is injected |
State Transitions
Navigation
- Trigger: User clicks link or
goto(path)is called. - Action: SvelteKit router intercepts the request.
- Data Fetching:
loadfunction in+page.tsor+layout.tsis executed. - Rendering: The new page component is rendered within the layout.
- URL Update: Browser history is updated.
Error Handling
- Trigger: Navigation to non-existent path or API failure.
- Action: SvelteKit renders
+error.svelte. - Display: User-friendly error message with recovery options.