Skip to content

Commit

Permalink
fix: fix search command
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdibha committed Nov 2, 2024
1 parent 4e66f89 commit a7487fe
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion www/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const config = {
},
],
},
transpilePackages: ["jotai-devtools"],
};

export default withMDX(config);
3 changes: 1 addition & 2 deletions www/src/components/search-command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
Loader2Icon,
SearchIcon,
TextIcon,
Undo2Icon,
} from "lucide-react";
import { kekabCaseToTitle } from "@/lib/string";
import { useCommandMenuInputRef } from "@/hooks/use-focus-command-menu";
Expand Down Expand Up @@ -71,7 +70,7 @@ export const SearchCommand = ({
const { setInputRef } = useCommandMenuInputRef();

React.useEffect(() => {
if (context) setInputRef(inputRef);
if (context && inputRef.current) setInputRef(inputRef);
}, [context, setInputRef]);

return (
Expand Down
2 changes: 1 addition & 1 deletion www/src/config/site-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export const siteConfig = {
export const searchConfig = {
defaultResults: [
{ name: "Installation", href: "/docs/getting-started/installation" },
{ name: "Themes", href: "/themes" },
{ name: "Button", href: "/docs/components/buttons/button" },
{ name: "TextField", href: "/docs/components/inputs/text-field" },
{ name: "Menu", href: "/docs/components/menus-and-selection/menu" },
],
};
4 changes: 2 additions & 2 deletions www/src/hooks/use-focus-command-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { RefObject } from "react";
import { create } from "zustand";

type FocusCommandMenuStore = {
inputRef: RefObject<HTMLInputElement> | null;
setInputRef: (ref: RefObject<HTMLInputElement>) => void;
inputRef: RefObject<HTMLInputElement | null> | null;
setInputRef: (ref: RefObject<HTMLInputElement | null>) => void;
focusInput: () => void;
};

Expand Down

0 comments on commit a7487fe

Please sign in to comment.