Refactor sidebar display

This commit is contained in:
Gregory Schier
2023-04-01 20:58:53 -07:00
parent 11a89f06c1
commit 3105ae0edc
9 changed files with 67 additions and 69 deletions

View File

@@ -11,9 +11,12 @@ const introspectionRequestBody = JSON.stringify({
});
export function useIntrospectGraphQL(baseRequest: HttpRequest) {
const url = useDebouncedValue(baseRequest.url);
// Debounce the URL because it can change rapidly, and we don't
// want to send so many requests.
const debouncedUrl = useDebouncedValue(baseRequest.url);
return useQuery<GraphQLSchema, Error>({
queryKey: ['introspectGraphQL', { url }],
queryKey: ['introspectGraphQL', { url: debouncedUrl }],
refetchOnWindowFocus: true,
// staleTime: 1000 * 60 * 60, // 1 hour
refetchInterval: 1000 * 60, // Refetch every minute