Skip to content

Conversation

@jovnc
Copy link
Collaborator

@jovnc jovnc commented Jan 19, 2026

Fixes #18

Fix refetch behaviour of useQuery hooks to stop refetching on mount and focus unnecessarily, and set stale time as 5 minutes.

@damithc In this PR, I also updated the note as shown below to indicate that changes might not be include updates in the last 5 minutes.

image

@jovnc jovnc requested a review from Copilot January 19, 2026 11:56
@jovnc jovnc added the bug Something isn't working label Jan 19, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes React Query caching behavior to reduce unnecessary API calls by setting a 5-minute stale time and disabling automatic refetches on mount and window focus. The UI messaging has been updated to inform users about the potential 5-minute data delay.

Changes:

  • Configure React Query hooks with 5-minute staleTime and disabled auto-refetch behavior
  • Update dashboard note to clearly communicate the 5-minute cache window
  • Improve HTML structure by using semantic <div> and <p> tags

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/api/queries/get_user_progress.ts Added staleTime (5 minutes) and disabled refetchOnMount and refetchOnWindowFocus
src/api/queries/get_user.ts Added staleTime (5 minutes) and disabled refetchOnMount and refetchOnWindowFocus
src/api/queries/get_exercises.ts Added staleTime (5 minutes) and disabled refetchOnMount and refetchOnWindowFocus
src/components/dashboard/DashboardHeader.tsx Updated note text to mention 5-minute delay and restructured HTML with proper semantic tags

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Repeated network calls for hooks

1 participant