Skip to content

fix: stop redundant refetching of immutable gene data - #182

Open
VinLau wants to merge 1 commit into
stagingfrom
fix/query-redundant-refetch
Open

fix: stop redundant refetching of immutable gene data#182
VinLau wants to merge 1 commit into
stagingfrom
fix/query-redundant-refetch

Conversation

@VinLau

@VinLau VinLau commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Just a simple change to React Query's defaults (staleTime 0 + refetchOnWindowFocus) caused every view to re-fetch its data on each tab focus/long pause like a subscriber-model. BAR expression data is immutable per gene, so set staleTime Infinity and disable focus refetch app-wide; this made many redundant recalls to the (costly) API. Queries remain keyed by gene id, so switching genes still fetches and returning to a gene is served from cache. If we ever need to have a re-fetch (I doubt it) we'll change it back.

Before:

image

After:

image

Just a simple change to React Query's defaults (staleTime 0 + refetchOnWindowFocus) caused every view to re-fetch its data on each tab focus. BAR expression data is
immutable per gene, so set staleTime Infinity and disable focus refetch
app-wide; this made many redundant recalls to the (costly) API. Queries remain keyed by gene id, so switching genes still
fetches and returning to a gene is served from cache. If we ever need to have a re-fetch (I doubt it) we'll change it back
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant