Skip to content

Commit

Permalink
fix: command palette search (#6651)
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekshourya29 authored Feb 20, 2025
1 parent 8bcc295 commit 8fa45ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const CommandPaletteSearchResults: React.FC<Props> = (props) => {
const section = (results.results as any)[key];
const currentSection = commandGroups[key];

if (!currentSection) return null;
if (section.length > 0) {
return (
<Command.Group key={key} heading={`${currentSection.title} search`}>
Expand Down
5 changes: 3 additions & 2 deletions web/core/components/command-palette/command-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const workspaceService = new WorkspaceService();
export const CommandModal: React.FC = observer(() => {
// router
const router = useAppRouter();
const { workspaceSlug, workItem } = useParams();
const { workspaceSlug, projectId: routerProjectId, workItem } = useParams();
// states
const [placeholder, setPlaceholder] = useState("Type a command or search...");
const [resultsCount, setResultsCount] = useState(0);
Expand Down Expand Up @@ -91,7 +91,7 @@ export const CommandModal: React.FC = observer(() => {
// derived values
const issueDetails = workItemDetailsSWR ? getIssueById(workItemDetailsSWR?.id) : null;
const issueId = issueDetails?.id;
const projectId = issueDetails?.project_id;
const projectId = issueDetails?.project_id ?? routerProjectId;
const page = pages[pages.length - 1];
const debouncedSearchTerm = useDebounce(searchTerm, 500);
const { baseTabIndex } = getTabIndex(undefined, isMobile);
Expand Down Expand Up @@ -477,6 +477,7 @@ export const CommandModal: React.FC = observer(() => {
<ToggleSwitch
value={isWorkspaceLevel}
onChange={() => setIsWorkspaceLevel((prevData) => !prevData)}
disabled={!projectId}
size="sm"
/>
</div>
Expand Down

0 comments on commit 8fa45ef

Please sign in to comment.