mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 01:09:54 +08:00
fix: exception display when restart quick search
This commit is contained in:
@@ -61,7 +61,7 @@ export const QuickSearch = ({ open, onClose }: TransitionsModalProps) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<StyledModalHeader>
|
<StyledModalHeader>
|
||||||
<Input setQuery={setQuery} setLoading={setLoading} />
|
<Input query={query} setQuery={setQuery} setLoading={setLoading} />
|
||||||
<StyledShortcut>{isMac() ? '⌘ + K' : 'Ctrl + K'}</StyledShortcut>
|
<StyledShortcut>{isMac() ? '⌘ + K' : 'Ctrl + K'}</StyledShortcut>
|
||||||
</StyledModalHeader>
|
</StyledModalHeader>
|
||||||
<StyledModalDivider />
|
<StyledModalDivider />
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { SearchIcon } from '@blocksuite/icons';
|
|||||||
import { StyledInputContent, StyledLabel } from './style';
|
import { StyledInputContent, StyledLabel } from './style';
|
||||||
import { Command } from 'cmdk';
|
import { Command } from 'cmdk';
|
||||||
export const Input = (props: {
|
export const Input = (props: {
|
||||||
|
query: string;
|
||||||
setQuery: Dispatch<SetStateAction<string>>;
|
setQuery: Dispatch<SetStateAction<string>>;
|
||||||
setLoading: Dispatch<SetStateAction<boolean>>;
|
setLoading: Dispatch<SetStateAction<boolean>>;
|
||||||
}) => {
|
}) => {
|
||||||
@@ -18,6 +19,9 @@ export const Input = (props: {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return inputRef.current?.focus();
|
return inputRef.current?.focus();
|
||||||
}, [inputRef]);
|
}, [inputRef]);
|
||||||
|
useEffect(() => {
|
||||||
|
return setInputValue(props.query);
|
||||||
|
}, []);
|
||||||
return (
|
return (
|
||||||
<StyledInputContent>
|
<StyledInputContent>
|
||||||
<StyledLabel htmlFor=":r5:">
|
<StyledLabel htmlFor=":r5:">
|
||||||
|
|||||||
Reference in New Issue
Block a user