Add cache and stale timers for most react query

This commit is contained in:
ajnart
2023-01-31 11:45:52 +09:00
parent e9eebadce6
commit 6586cdd060
8 changed files with 45 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
import { Autocomplete, createStyles, Flex, Tabs, TextInput } from '@mantine/core';
import { Autocomplete, createStyles, Flex, Tabs } from '@mantine/core';
import { UseFormReturnType } from '@mantine/form';
import { useQuery } from '@tanstack/react-query';
import { useTranslation } from 'next-i18next';

View File

@@ -16,7 +16,7 @@ export const AppPing = ({ app }: AppPingProps) => {
(config?.settings.customization.layout.enabledPing && app.network.enabledStatusChecker) ??
false;
const { data, isLoading } = useQuery({
queryKey: [`ping/${app.id}`],
queryKey: ['ping', { id: app.id, name: app.name }],
queryFn: async () => {
const response = await fetch(`/api/modules/ping?url=${encodeURI(app.url)}`);
const isOk = app.network.okStatus.includes(response.status);