From a12aed723fd43ba1da6e23bdb3e9969f4c56de67 Mon Sep 17 00:00:00 2001 From: Ou Date: Sun, 6 Oct 2024 01:20:59 +0800 Subject: [PATCH] feat: set timeout --- src/components/header.tsx | 11 ++++++++++- src/components/section/card.tsx | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/header.tsx b/src/components/header.tsx index 68dbc0b..7b7e881 100644 --- a/src/components/header.tsx +++ b/src/components/header.tsx @@ -1,6 +1,9 @@ import { Link } from "@tanstack/react-router" import { useCallback } from "react" import { useAtomValue, useSetAtom } from "jotai" +import { useIsFetching } from "@tanstack/react-query" +import clsx from "clsx" +import type { SourceID } from "@shared/types" import logo from "~/assets/react.svg" import { useDark } from "~/hooks/useDark" import { currentSectionAtom, refetchSourcesAtom } from "~/atoms" @@ -28,8 +31,14 @@ function RefreshButton() { })) }, [currentSection, setRefetchSource]) + const isFetching = useIsFetching({ + predicate: (query) => { + return currentSection.sourceList.includes(query.queryKey[0] as SourceID) + }, + }) + return ( -