Skip to content

Commit 8fa45ef

Browse files
fix: command palette search (#6651)
1 parent 8bcc295 commit 8fa45ef

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

web/core/components/command-palette/actions/search-results.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export const CommandPaletteSearchResults: React.FC<Props> = (props) => {
2828
const section = (results.results as any)[key];
2929
const currentSection = commandGroups[key];
3030

31+
if (!currentSection) return null;
3132
if (section.length > 0) {
3233
return (
3334
<Command.Group key={key} heading={`${currentSection.title} search`}>

web/core/components/command-palette/command-modal.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const workspaceService = new WorkspaceService();
5151
export const CommandModal: React.FC = observer(() => {
5252
// router
5353
const router = useAppRouter();
54-
const { workspaceSlug, workItem } = useParams();
54+
const { workspaceSlug, projectId: routerProjectId, workItem } = useParams();
5555
// states
5656
const [placeholder, setPlaceholder] = useState("Type a command or search...");
5757
const [resultsCount, setResultsCount] = useState(0);
@@ -91,7 +91,7 @@ export const CommandModal: React.FC = observer(() => {
9191
// derived values
9292
const issueDetails = workItemDetailsSWR ? getIssueById(workItemDetailsSWR?.id) : null;
9393
const issueId = issueDetails?.id;
94-
const projectId = issueDetails?.project_id;
94+
const projectId = issueDetails?.project_id ?? routerProjectId;
9595
const page = pages[pages.length - 1];
9696
const debouncedSearchTerm = useDebounce(searchTerm, 500);
9797
const { baseTabIndex } = getTabIndex(undefined, isMobile);
@@ -477,6 +477,7 @@ export const CommandModal: React.FC = observer(() => {
477477
<ToggleSwitch
478478
value={isWorkspaceLevel}
479479
onChange={() => setIsWorkspaceLevel((prevData) => !prevData)}
480+
disabled={!projectId}
480481
size="sm"
481482
/>
482483
</div>

0 commit comments

Comments
 (0)