Skip to content

Commit

Permalink
Dashboard: disable data refetch, when window regains focus to keep ma…
Browse files Browse the repository at this point in the history
…p zoom state
  • Loading branch information
JohannaPeanut committed Dec 8, 2023
1 parent f32bded commit ed067c7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/pages/[projectSlug]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ import getSubsections from "src/subsections/queries/getSubsections"
export const ProjectDashboardWithQuery = () => {
const projectSlug = useParam("projectSlug", "string")
const [project] = useQuery(getProject, { slug: projectSlug })
const [{ subsections }] = useQuery(getSubsections, { projectSlug: projectSlug! })
const [{ subsections }] = useQuery(
getSubsections,
{ projectSlug: projectSlug! },
{
// This ensures the query does not refresh when the window regains focus https://blitzjs.com/docs/query-usage
refetchOnWindowFocus: false,
},
)

// We use the URL param `operator` to filter the UI
// Docs: https://blitzjs.com/docs/route-params-query#use-router-query
Expand Down

0 comments on commit ed067c7

Please sign in to comment.