The fleet list had a tag filter and nothing else: no search, no sort, and an unbounded list. Searching hostname/address/OS and sorting by hostname, status or last seen are all client-side, since the browser already holds the fleet the page just fetched. Sorting by status orders by how much attention each state wants rather than alphabetically, which is the only reason to sort by it. The filtered count is shown beside the total so a search does not read as the fleet having shrunk, and "no results" is a distinct empty state from "no servers", with a way back out of the search. refetchIntervalInBackground defaults to false on the query client. Polling pages kept refetching in a hidden tab — the fleet list pulls inventory blobs every 30s — so a console left open in a background tab polled until its session expired. It belongs in the defaults because the argument is identical on every polling page.
20 lines
718 B
TypeScript
20 lines
718 B
TypeScript
"use client";
|
|
|
|
import { QueryClient } from "@tanstack/react-query";
|
|
|
|
export const queryClient = new QueryClient({
|
|
defaultOptions: {
|
|
queries: {
|
|
staleTime: 30_000,
|
|
retry: 1,
|
|
// Several pages poll on an interval — the fleet list every 30s, run logs
|
|
// faster than that. A hidden tab was still doing all of it, so a console
|
|
// left open overnight in a background tab kept refetching the fleet and
|
|
// its inventory blobs until the session expired. The default here rather
|
|
// than per page, because the argument is the same everywhere and the
|
|
// pages that poll are exactly the ones nobody remembers to check.
|
|
refetchIntervalInBackground: false,
|
|
},
|
|
},
|
|
});
|