From 4f8e3dcaae6d6bbab06344e9c794063712acb57c Mon Sep 17 00:00:00 2001 From: echobt Date: Fri, 27 Feb 2026 19:25:31 +0000 Subject: [PATCH] fix: remove duplicate Command Palette rendering (fixes PlatformNetwork/bounty-challenge#21923) Removed the old CommandPalette component import and render from AppCore.tsx, keeping only PaletteCommandPalette. Added command-palette:toggle event listener to PaletteCommandPalette to preserve toggle functionality. --- src/AppCore.tsx | 2 -- src/components/palette/CommandPalette.tsx | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/AppCore.tsx b/src/AppCore.tsx index a03202f..fe0a9e9 100644 --- a/src/AppCore.tsx +++ b/src/AppCore.tsx @@ -54,7 +54,6 @@ const ToastManager = lazy(() => import("@/components/ToastManager").then(m => ({ const NotificationCenter = lazy(() => import("@/components/NotificationCenter").then(m => ({ default: m.NotificationCenter }))); // COMMAND PALETTE - Core UI, should load early -const CommandPalette = lazy(() => import("@/components/CommandPalette").then(m => ({ default: m.CommandPalette }))); const ViewQuickAccess = lazy(() => import("@/components/ViewQuickAccess").then(m => ({ default: m.ViewQuickAccess }))); const PaletteCommandPalette = lazy(() => import("@/components/palette/CommandPalette").then(m => ({ default: m.PaletteCommandPalette }))); const PaletteQuickOpen = lazy(() => import("@/components/palette/QuickOpen").then(m => ({ default: m.PaletteQuickOpen }))); @@ -568,7 +567,6 @@ function AppContent(props: ParentProps) { - diff --git a/src/components/palette/CommandPalette.tsx b/src/components/palette/CommandPalette.tsx index 63628a0..84914f9 100644 --- a/src/components/palette/CommandPalette.tsx +++ b/src/components/palette/CommandPalette.tsx @@ -159,8 +159,9 @@ export function PaletteCommandPalette() { }; const handleGlobalEsc = (e: KeyboardEvent) => { if (e.key === "Escape" && showCommandPalette()) { e.preventDefault(); setShowCommandPalette(false); } }; - onMount(() => window.addEventListener("keydown", handleGlobalEsc)); - onCleanup(() => window.removeEventListener("keydown", handleGlobalEsc)); + const handleToggleEvent = () => { setShowCommandPalette(!showCommandPalette()); }; + onMount(() => { window.addEventListener("keydown", handleGlobalEsc); window.addEventListener("command-palette:toggle", handleToggleEvent); }); + onCleanup(() => { window.removeEventListener("keydown", handleGlobalEsc); window.removeEventListener("command-palette:toggle", handleToggleEvent); }); const itemStyle = (sel: boolean): JSX.CSSProperties => ({ display: "flex", "align-items": "center", gap: "6px", height: "24px", padding: "0 8px", margin: "1px 4px",