Skip to content

Convert remaining unconditional useQuery call sites to useSuspenseQuery #109

Description

@chiptus

Context

Follow-up from a broader useQuery audit during PR #107 review. Four hooks are called unconditionally (no real enabled: gating, no deliberate inline error/loading UI) for data that's either already prefetched by a route loader, or easily could be — good candidates for the loader-prefetch + useSuspenseQuery pattern used elsewhere in this codebase.

Candidates

  1. useGroupMembersQuery (src/api/groups/useGroupMembers.ts, called from useSetFiltering.ts) — already prefetched by the group route loader (groups/$groupSlug.tsx).
  2. useUserGroupsQuery (src/api/groups/useUserGroups.ts, called from SetGroupVoting.tsx) — same data the /groups/ route loader already prefetches via userGroupsQuery; this call site duplicates it without Suspense.
  3. useFestivalsQuery (src/api/festivals/useFestivals.ts, called from FestivalSelection.tsx) — core content of the festival-selection page, unconditionally required; no loader currently prefetches it (would need one added).
  4. useGenresQuery (src/api/genres/useGenres.ts, called from GenreBadge and AddArtistDialog) — already prefetched by the sets route loader (sets/index.tsx); these call sites duplicate it.

Out of scope here

useStageQuery per-item flicker — tracked separately in #108.

Confirmed NOT candidates (checked, correctly plain useQuery): vote queries, invite validation, custom links, profile/permissions, duplicate-artists, admin roles, soundcloud playlist, analytics table — all have genuine enabled: conditions or deliberately show inline error/loading UI instead of throwing to Suspense.

Bonus finding — separate cleanup, not part of this issue

9 wrapper hooks appear to be dead code (never called anywhere; everything already reads their queryOptions factory directly via ensureQueryData/useSuspenseQuery): useSetBySlugQuery, useGroupInvitesQuery, useGroupBySlugQuery, useGroupDetailQuery, useFestivalQuery, useFestivalEditionQuery, useArtistQuery, useArtistBySlugQuery, useArtistNotesQuery. Worth a human check to confirm truly unused before deleting — tracked in #109.

Flagged during PR #107 review, not fixed there to keep that PR scoped to the loader-await change.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions