修复 useSearchParams 编译问题

This commit is contained in:
feie9456 2026-04-18 11:07:10 +08:00
parent 5cbb7217f0
commit be1b44190c

View File

@ -11,7 +11,7 @@ import {
type MutableRefObject,
type ReactNode,
} from "react";
import { usePathname, useSearchParams } from "next/navigation";
import { usePathname } from "next/navigation";
const SHOW_DELAY_MS = 120;
const MIN_VISIBLE_MS = 180;
@ -38,14 +38,12 @@ export function NavigationProgressProvider({
children: ReactNode;
}) {
const pathname = usePathname();
const searchParams = useSearchParams();
const [visible, setVisible] = useState(false);
const visibleRef = useRef(false);
const shownAtRef = useRef(0);
const showTimerRef = useRef<number | null>(null);
const hideTimerRef = useRef<number | null>(null);
const failsafeTimerRef = useRef<number | null>(null);
const search = searchParams.toString();
const setProgressVisible = useCallback((nextVisible: boolean) => {
visibleRef.current = nextVisible;
@ -97,7 +95,7 @@ export function NavigationProgressProvider({
useEffect(() => {
endNavigationProgress();
}, [pathname, search, endNavigationProgress]);
}, [pathname, endNavigationProgress]);
useEffect(() => {
function handleDocumentClick(event: MouseEvent) {