From 7f3b62845199f549cc1e55374b487084f2286dab Mon Sep 17 00:00:00 2001 From: JOYCEQL <1449239013@qq.com> Date: Fri, 22 Nov 2024 15:02:47 +0800 Subject: [PATCH] perf: sidePanel Section Delete --- apps/fronted/src/components/editor/SidePanel.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/fronted/src/components/editor/SidePanel.tsx b/apps/fronted/src/components/editor/SidePanel.tsx index fce339a..dfd4996 100644 --- a/apps/fronted/src/components/editor/SidePanel.tsx +++ b/apps/fronted/src/components/editor/SidePanel.tsx @@ -216,7 +216,11 @@ export function SidePanel() { updateMenuSections( menuSections.filter((section) => section.id !== item.id) ); - setActiveSection(menuSections[0].id); + setActiveSection( + menuSections[ + menuSections.findIndex((s) => s.id === item.id) - 1 + ].id + ); }} className={cn( "p-1.5 rounded-md text-primary",