修复 useSearchParams 编译问题
This commit is contained in:
parent
5cbb7217f0
commit
be1b44190c
@ -11,7 +11,7 @@ import {
|
|||||||
type MutableRefObject,
|
type MutableRefObject,
|
||||||
type ReactNode,
|
type ReactNode,
|
||||||
} from "react";
|
} from "react";
|
||||||
import { usePathname, useSearchParams } from "next/navigation";
|
import { usePathname } from "next/navigation";
|
||||||
|
|
||||||
const SHOW_DELAY_MS = 120;
|
const SHOW_DELAY_MS = 120;
|
||||||
const MIN_VISIBLE_MS = 180;
|
const MIN_VISIBLE_MS = 180;
|
||||||
@ -38,14 +38,12 @@ export function NavigationProgressProvider({
|
|||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
}) {
|
}) {
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const searchParams = useSearchParams();
|
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const visibleRef = useRef(false);
|
const visibleRef = useRef(false);
|
||||||
const shownAtRef = useRef(0);
|
const shownAtRef = useRef(0);
|
||||||
const showTimerRef = useRef<number | null>(null);
|
const showTimerRef = useRef<number | null>(null);
|
||||||
const hideTimerRef = useRef<number | null>(null);
|
const hideTimerRef = useRef<number | null>(null);
|
||||||
const failsafeTimerRef = useRef<number | null>(null);
|
const failsafeTimerRef = useRef<number | null>(null);
|
||||||
const search = searchParams.toString();
|
|
||||||
|
|
||||||
const setProgressVisible = useCallback((nextVisible: boolean) => {
|
const setProgressVisible = useCallback((nextVisible: boolean) => {
|
||||||
visibleRef.current = nextVisible;
|
visibleRef.current = nextVisible;
|
||||||
@ -97,7 +95,7 @@ export function NavigationProgressProvider({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
endNavigationProgress();
|
endNavigationProgress();
|
||||||
}, [pathname, search, endNavigationProgress]);
|
}, [pathname, endNavigationProgress]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function handleDocumentClick(event: MouseEvent) {
|
function handleDocumentClick(event: MouseEvent) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user