优化预加载策略
This commit is contained in:
@@ -21,7 +21,6 @@ const MobileHeader = ({ showBackButton = false }: MobileHeaderProps) => {
|
||||
<div className='flex items-center gap-2'>
|
||||
<Link
|
||||
href='/search'
|
||||
prefetch={false}
|
||||
className='w-10 h-10 p-2 rounded-full flex items-center justify-center text-gray-600 hover:bg-gray-200/50 dark:text-gray-300 dark:hover:bg-gray-700/50 transition-colors'
|
||||
>
|
||||
<svg
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import { BackButton } from './BackButton';
|
||||
@@ -18,9 +19,15 @@ interface PageLayoutProps {
|
||||
}
|
||||
|
||||
const PageLayout = ({ children, activePath = '/', hideNavigation = false }: PageLayoutProps) => {
|
||||
const router = useRouter();
|
||||
const [backgroundImage, setBackgroundImage] = useState('');
|
||||
const shouldShowSharedBackground = !hideNavigation && activePath !== '/play';
|
||||
|
||||
useEffect(() => {
|
||||
router.prefetch('/search');
|
||||
router.prefetch('/play');
|
||||
}, [router]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof window === 'undefined' || !shouldShowSharedBackground) {
|
||||
setBackgroundImage('');
|
||||
|
||||
Reference in New Issue
Block a user