From ad4cdcc5128224ef7bb412fe75b90bf0fe93317b Mon Sep 17 00:00:00 2001 From: Dakshesh Jain <65905942+dakshesh14@users.noreply.github.com> Date: Fri, 11 Aug 2023 17:16:37 +0530 Subject: [PATCH] fix: cmdk modal not closing when choosing an option (#1833) --- .../app/components/command-palette/command-k.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/app/components/command-palette/command-k.tsx b/apps/app/components/command-palette/command-k.tsx index 75d7e5bcc..6f3a0e5ef 100644 --- a/apps/app/components/command-palette/command-k.tsx +++ b/apps/app/components/command-palette/command-k.tsx @@ -354,8 +354,8 @@ export const CommandK: React.FC = ({ deleteIssue, isPaletteOpen, setIsPal { - router.push(currentSection.path(item)); setIsPaletteOpen(false); + router.push(currentSection.path(item)); }} value={`${key}-${item?.name}`} className="focus:outline-none" @@ -379,6 +379,7 @@ export const CommandK: React.FC = ({ deleteIssue, isPaletteOpen, setIsPal { + setIsPaletteOpen(false); setPlaceholder("Change state..."); setSearchTerm(""); setPages([...pages, "change-issue-state"]); @@ -460,6 +461,7 @@ export const CommandK: React.FC = ({ deleteIssue, isPaletteOpen, setIsPal { + setIsPaletteOpen(false); const e = new KeyboardEvent("keydown", { key: "c", }); @@ -479,6 +481,7 @@ export const CommandK: React.FC = ({ deleteIssue, isPaletteOpen, setIsPal { + setIsPaletteOpen(false); const e = new KeyboardEvent("keydown", { key: "p", }); @@ -500,6 +503,7 @@ export const CommandK: React.FC = ({ deleteIssue, isPaletteOpen, setIsPal { + setIsPaletteOpen(false); const e = new KeyboardEvent("keydown", { key: "q", }); @@ -517,6 +521,7 @@ export const CommandK: React.FC = ({ deleteIssue, isPaletteOpen, setIsPal { + setIsPaletteOpen(false); const e = new KeyboardEvent("keydown", { key: "m", }); @@ -534,6 +539,7 @@ export const CommandK: React.FC = ({ deleteIssue, isPaletteOpen, setIsPal { + setIsPaletteOpen(false); const e = new KeyboardEvent("keydown", { key: "v", }); @@ -551,6 +557,7 @@ export const CommandK: React.FC = ({ deleteIssue, isPaletteOpen, setIsPal { + setIsPaletteOpen(false); const e = new KeyboardEvent("keydown", { key: "d", }); @@ -568,11 +575,12 @@ export const CommandK: React.FC = ({ deleteIssue, isPaletteOpen, setIsPal {projectDetails && projectDetails.inbox_view && ( + onSelect={() => { + setIsPaletteOpen(false); redirect( `/${workspaceSlug}/projects/${projectId}/inbox/${inboxList?.[0]?.id}` - ) - } + ); + }} className="focus:outline-none" >