import type { ReactNode } from "react"; import type { UseQueryResult } from "@tanstack/react-query"; import * as stylex from "@stylexjs/stylex"; import InlineError from "@/lib/InlineError"; import { styles as shared } from "@/ui/styles"; import { styles } from "./styles"; /** * One panel's data, with the loading and error surfaces the fire-and-forget * route loaders leave to the page. A configuration page holds several * independent collections; each states its own condition instead of the whole * page waiting on the slowest request. */ export default function QueryPanel({ query, children, }: { query: UseQueryResult; children: (data: T) => ReactNode; }) { if (query.isPending) { return (

Loading…

); } if (query.isError) return void query.refetch()} />; return <>{children(query.data)}; }