Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

fix: command palette search (#6651)

Prateek Shourya8fa45ef9a652
diff --git a/web/core/components/command-palette/actions/search-results.tsx b/web/core/components/command-palette/actions/search-results.tsx
index dba61ecc36..8d67635ba9 100644
--- a/web/core/components/command-palette/actions/search-results.tsx
+++ b/web/core/components/command-palette/actions/search-results.tsx
@@ -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`}>
diff --git a/web/core/components/command-palette/command-modal.tsx b/web/core/components/command-palette/command-modal.tsx
index 1550a929cf..7fdc96f5a7 100644
--- a/web/core/components/command-palette/command-modal.tsx
+++ b/web/core/components/command-palette/command-modal.tsx
@@ -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);
@@ -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);
@@ -477,6 +477,7 @@ export const CommandModal: React.FC = observer(() => {
<ToggleSwitch
value={isWorkspaceLevel}
onChange={() => setIsWorkspaceLevel((prevData) => !prevData)}
+ disabled={!projectId}
size="sm"
/>
</div>