fix: exception display when restart quick search

This commit is contained in:
JimmFly
2022-12-16 14:25:26 +08:00
parent 1ef492dbc8
commit 8a3f239dd5
2 changed files with 5 additions and 1 deletions
@@ -61,7 +61,7 @@ export const QuickSearch = ({ open, onClose }: TransitionsModalProps) => {
}}
>
<StyledModalHeader>
<Input setQuery={setQuery} setLoading={setLoading} />
<Input query={query} setQuery={setQuery} setLoading={setLoading} />
<StyledShortcut>{isMac() ? '⌘ + K' : 'Ctrl + K'}</StyledShortcut>
</StyledModalHeader>
<StyledModalDivider />
@@ -9,6 +9,7 @@ import { SearchIcon } from '@blocksuite/icons';
import { StyledInputContent, StyledLabel } from './style';
import { Command } from 'cmdk';
export const Input = (props: {
query: string;
setQuery: Dispatch<SetStateAction<string>>;
setLoading: Dispatch<SetStateAction<boolean>>;
}) => {
@@ -18,6 +19,9 @@ export const Input = (props: {
useEffect(() => {
return inputRef.current?.focus();
}, [inputRef]);
useEffect(() => {
return setInputValue(props.query);
}, []);
return (
<StyledInputContent>
<StyledLabel htmlFor=":r5:">