Skip to content

Bug: getServerHistory() called at module load time may return empty array during SSR #20

Description

@Priyanshubhartistm

Bug Report

File: src/routes/+page.svelte

Description

serverHistory is initialized by calling getServerHistory() directly at the top of the script block (line 26). Since this runs during SSR in SvelteKit, getServerHistory() detects typeof window === 'undefined' and returns [], causing a flash of empty history list on first client render until hydration corrects it.

Affected Code (line 26)

let serverHistory = $state<ServerHistoryItem[]>(getServerHistory()); // runs during SSR → []

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions