diff --git a/src/renderer/src/Routes.tsx b/src/renderer/src/Routes.tsx index 805cee726b..50064f9490 100644 --- a/src/renderer/src/Routes.tsx +++ b/src/renderer/src/Routes.tsx @@ -1,5 +1,4 @@ import { AnimatePresence, motion } from 'framer-motion' -import { useEffect, useState } from 'react' import { Route, Routes, useLocation } from 'react-router-dom' import styled from 'styled-components' @@ -18,7 +17,6 @@ const WILDCARD_ROUTES = ['/settings', '/paintings', '/mcp-servers'] const RouteContainer = () => { const location = useLocation() const isHomePage = location.pathname === '/' - const [isReady, setIsReady] = useState(false) // 获取当前路径的主路由部分 const mainPath = WILDCARD_ROUTES.find((route) => location.pathname.startsWith(route)) @@ -26,14 +24,6 @@ const RouteContainer = () => { // 使用主路由作为 key,这样同一主路由下的切换不会触发动画 const animationKey = mainPath || location.pathname - // 路由变化时重置状态 - useEffect(() => { - setIsReady(false) - // 给一个很短的延迟,确保组件已经渲染 - const timer = setTimeout(() => setIsReady(true), 300) - return () => clearTimeout(timer) - }, [location.pathname]) - return ( @@ -41,8 +31,8 @@ const RouteContainer = () => { {!isHomePage && ( @@ -92,7 +82,7 @@ const PageContainer = styled(motion.div)` const pageTransition = { type: 'tween', - duration: 0.25, + duration: 0.15, ease: 'easeInOut' }