Skip to content

fix: useScheduleData returns hardcoded loading/error fields that never vary #169

Description

@chiptus

Problem

src/hooks/useScheduleData.ts:60-61, 175-180:

const loading = false;
const error = null;
...
return { scheduleDays, allStages, loading, error };

loading/error are hardcoded constants, never varying — but callers (Timeline.tsx, ListSchedule.tsx) still branch on if (loading) / if (error), code that can never execute. The hook's interface advertises async-state handling it doesn't actually do (the real async state lives in the suspense queries upstream of it).

The grouping/enrichment logic in the hook's useMemo (lines 63-163) is real and worth keeping as-is — this ticket is scoped to the dead loading/error fields only.

Note: distinct from #156, which covers the leftover console.log("no stageId", set) at line 121 in this same file — that's already ticketed; don't duplicate it here.

Fix

Drop loading/error from the hook's return type and delete the dead branches in both callers.

Architecture note

Filed from an architecture review (module/interface/depth vocabulary, see /codebase-design). Interface should shrink to what the module actually does.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions