fix: 修复ci中出现的错误
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 4m29s
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 4m29s
This commit is contained in:
@@ -2,14 +2,15 @@
|
|||||||
|
|
||||||
import { motion, AnimatePresence } from 'framer-motion';
|
import { motion, AnimatePresence } from 'framer-motion';
|
||||||
import { usePathname, useSearchParams } from 'next/navigation';
|
import { usePathname, useSearchParams } from 'next/navigation';
|
||||||
import { useEffect, useState, useRef } from 'react';
|
import { useEffect, useState, useRef, Suspense } from 'react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
|
|
||||||
interface PageTransitionProps {
|
interface PageTransitionProps {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function PageTransition({ children }: PageTransitionProps) {
|
// 内部组件:使用 useSearchParams 的部分
|
||||||
|
function PageTransitionContent({ children }: { children: React.ReactNode }) {
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -171,3 +172,20 @@ export default function PageTransition({ children }: PageTransitionProps) {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 加载状态组件
|
||||||
|
function PageTransitionFallback() {
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen">
|
||||||
|
{null}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function PageTransition({ children }: PageTransitionProps) {
|
||||||
|
return (
|
||||||
|
<Suspense fallback={<PageTransitionFallback />}>
|
||||||
|
<PageTransitionContent>{children}</PageTransitionContent>
|
||||||
|
</Suspense>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user