fix: command palette search (#6651)
This commit is contained in:
parent
8bcc295061
commit
8fa45ef9a6
2 changed files with 4 additions and 2 deletions
|
|
@ -28,6 +28,7 @@ export const CommandPaletteSearchResults: React.FC<Props> = (props) => {
|
||||||
const section = (results.results as any)[key];
|
const section = (results.results as any)[key];
|
||||||
const currentSection = commandGroups[key];
|
const currentSection = commandGroups[key];
|
||||||
|
|
||||||
|
if (!currentSection) return null;
|
||||||
if (section.length > 0) {
|
if (section.length > 0) {
|
||||||
return (
|
return (
|
||||||
<Command.Group key={key} heading={`${currentSection.title} search`}>
|
<Command.Group key={key} heading={`${currentSection.title} search`}>
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ const workspaceService = new WorkspaceService();
|
||||||
export const CommandModal: React.FC = observer(() => {
|
export const CommandModal: React.FC = observer(() => {
|
||||||
// router
|
// router
|
||||||
const router = useAppRouter();
|
const router = useAppRouter();
|
||||||
const { workspaceSlug, workItem } = useParams();
|
const { workspaceSlug, projectId: routerProjectId, workItem } = useParams();
|
||||||
// states
|
// states
|
||||||
const [placeholder, setPlaceholder] = useState("Type a command or search...");
|
const [placeholder, setPlaceholder] = useState("Type a command or search...");
|
||||||
const [resultsCount, setResultsCount] = useState(0);
|
const [resultsCount, setResultsCount] = useState(0);
|
||||||
|
|
@ -91,7 +91,7 @@ export const CommandModal: React.FC = observer(() => {
|
||||||
// derived values
|
// derived values
|
||||||
const issueDetails = workItemDetailsSWR ? getIssueById(workItemDetailsSWR?.id) : null;
|
const issueDetails = workItemDetailsSWR ? getIssueById(workItemDetailsSWR?.id) : null;
|
||||||
const issueId = issueDetails?.id;
|
const issueId = issueDetails?.id;
|
||||||
const projectId = issueDetails?.project_id;
|
const projectId = issueDetails?.project_id ?? routerProjectId;
|
||||||
const page = pages[pages.length - 1];
|
const page = pages[pages.length - 1];
|
||||||
const debouncedSearchTerm = useDebounce(searchTerm, 500);
|
const debouncedSearchTerm = useDebounce(searchTerm, 500);
|
||||||
const { baseTabIndex } = getTabIndex(undefined, isMobile);
|
const { baseTabIndex } = getTabIndex(undefined, isMobile);
|
||||||
|
|
@ -477,6 +477,7 @@ export const CommandModal: React.FC = observer(() => {
|
||||||
<ToggleSwitch
|
<ToggleSwitch
|
||||||
value={isWorkspaceLevel}
|
value={isWorkspaceLevel}
|
||||||
onChange={() => setIsWorkspaceLevel((prevData) => !prevData)}
|
onChange={() => setIsWorkspaceLevel((prevData) => !prevData)}
|
||||||
|
disabled={!projectId}
|
||||||
size="sm"
|
size="sm"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue