From e9a081d46b4bbe5f4c004f695e2920e5ecbc26a8 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Sun, 1 Mar 2026 20:02:04 +0800 Subject: [PATCH] refactor(react19): replace Context.Provider with Context value={} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 升级 6 个文件的 Context 语法为 React 19 标准 - ThemeProviderContext, ChartContext, AnimationContext, TourContext, AssetStoreContext, RestartContext - 构建验证通过 - 功能完全等价 --- dashboard/src/components/animation-provider.tsx | 2 +- dashboard/src/components/asset-provider.tsx | 2 +- dashboard/src/components/theme-provider.tsx | 4 ++-- dashboard/src/components/tour/tour-provider.tsx | 4 ++-- dashboard/src/components/ui/chart.tsx | 4 ++-- dashboard/src/lib/restart-context.tsx | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dashboard/src/components/animation-provider.tsx b/dashboard/src/components/animation-provider.tsx index 2a72ba1d..b9684a11 100644 --- a/dashboard/src/components/animation-provider.tsx +++ b/dashboard/src/components/animation-provider.tsx @@ -50,5 +50,5 @@ export function AnimationProvider({ setEnableWavesBackground, } - return {children} + return {children} } diff --git a/dashboard/src/components/asset-provider.tsx b/dashboard/src/components/asset-provider.tsx index 203301c0..028e27e1 100644 --- a/dashboard/src/components/asset-provider.tsx +++ b/dashboard/src/components/asset-provider.tsx @@ -52,7 +52,7 @@ export function AssetStoreProvider({ children }: AssetStoreProviderProps) { } }, []) - return {children} + return {children} } export function useAssetStore() { diff --git a/dashboard/src/components/theme-provider.tsx b/dashboard/src/components/theme-provider.tsx index 79d65f02..2455a34e 100644 --- a/dashboard/src/components/theme-provider.tsx +++ b/dashboard/src/components/theme-provider.tsx @@ -90,8 +90,8 @@ export function ThemeProvider({ ) return ( - + {children} - + ) } diff --git a/dashboard/src/components/tour/tour-provider.tsx b/dashboard/src/components/tour/tour-provider.tsx index 673b5148..0d6d7e0b 100644 --- a/dashboard/src/components/tour/tour-provider.tsx +++ b/dashboard/src/components/tour/tour-provider.tsx @@ -153,7 +153,7 @@ export function TourProvider({ children }: { children: ReactNode }) { }, []) return ( - {children} - + ) } diff --git a/dashboard/src/components/ui/chart.tsx b/dashboard/src/components/ui/chart.tsx index c8f5252f..a50431ac 100644 --- a/dashboard/src/components/ui/chart.tsx +++ b/dashboard/src/components/ui/chart.tsx @@ -45,7 +45,7 @@ const ChartContainer = React.forwardRef< const chartId = `chart-${id || uniqueId.replace(/:/g, "")}` return ( - +
-
+ ) }) ChartContainer.displayName = "Chart" diff --git a/dashboard/src/lib/restart-context.tsx b/dashboard/src/lib/restart-context.tsx index 53ef0d31..49c56757 100644 --- a/dashboard/src/lib/restart-context.tsx +++ b/dashboard/src/lib/restart-context.tsx @@ -310,9 +310,9 @@ export function RestartProvider({ } return ( - + {children} - + ) }