getQueryData reads previously fetched data from the React Query cache through a query client. In an edit form, it can reuse a bookable already loaded by the list page instead of immediately showing a loading spinner. section 10.3.4
Populate an edit form from cached data
Call useQueryClient to obtain the client, then pass the relevant query key to getQueryData. To select one bookable, find its ID in the cached list: const queryClient = useQueryClient(); const bookables = queryClient.getQueryData("bookables"); const bookable = bookables?.find(b => b.id === id); This value can supply useQuery's initialData. When it is present, the first query call can avoid a server fetch; when it is undefined, such as after direct navigation, useQuery fetches the data. section 10.3.4
const bookables = queryClient.getQueryData("bookables");
Shows the direct query-client call used to retrieve the cached bookables list. section 10.3.4
