From 93019f56cf663749b0166fb7427d18f1d752dfd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=A8=E9=9C=96=E9=93=83?= Date: Fri, 29 May 2026 20:55:05 +0800 Subject: [PATCH] refactor(RouterContainer): remove unnecessary useMemo and hoist constant - Replace useMemo with direct expression for animationClass - Move entryPointType to module scope (value is fixed after mount) Co-Authored-By: Claude Opus 4.8 --- src/components/RouterContainer.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/components/RouterContainer.tsx b/src/components/RouterContainer.tsx index 179ebf8..a8de5ce 100644 --- a/src/components/RouterContainer.tsx +++ b/src/components/RouterContainer.tsx @@ -1,21 +1,20 @@ import { FEATURES, getEntryPointType } from '@/config/features'; import { useRouter } from '@/providers/RouterProvider'; -import { Suspense, useMemo } from 'react'; +import { Suspense } from 'react'; import { useI18n } from '@/utils/chromeI18n'; import PageErrorBoundary from '@/components/PageErrorBoundary'; import PageSkeleton from '@/components/PageSkeleton'; import { cn } from '@/lib/utils'; import { AlertTriangle } from 'lucide-react'; +const entryPointType = getEntryPointType(); + export default function RouterContainer() { const { currentPage, isLoaded } = useRouter(); const { t } = useI18n('common'); - const animationClass = useMemo(() => { - return currentPage === 'dashboard' ? 'page-transition-dashboard' : 'page-transition-enter'; - }, [currentPage]); - - const entryPointType = getEntryPointType(); + const animationClass = + currentPage === 'dashboard' ? 'page-transition-dashboard' : 'page-transition-enter'; if (!isLoaded) { return ;