Prevent cmdk querying after selection is made
This commit is contained in:
parent
5214d76f46
commit
e3cd0e59cd
@ -97,7 +97,7 @@ export default function CommandKClient({
|
|||||||
}, [setIsOpen]);
|
}, [setIsOpen]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (queryDebounced.length >= MINIMUM_QUERY_LENGTH) {
|
if (queryDebounced.length >= MINIMUM_QUERY_LENGTH && !isPending) {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
onQueryChange?.(queryDebounced).then(querySections => {
|
onQueryChange?.(queryDebounced).then(querySections => {
|
||||||
if (isOpenRef.current) {
|
if (isOpenRef.current) {
|
||||||
@ -109,7 +109,7 @@ export default function CommandKClient({
|
|||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [queryDebounced, onQueryChange]);
|
}, [queryDebounced, onQueryChange, isPending]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (queryLive === '') {
|
if (queryLive === '') {
|
||||||
@ -182,7 +182,7 @@ export default function CommandKClient({
|
|||||||
placeholder="Search photos, views, settings ..."
|
placeholder="Search photos, views, settings ..."
|
||||||
disabled={isPending}
|
disabled={isPending}
|
||||||
/>
|
/>
|
||||||
{isLoading &&
|
{isLoading && !isPending &&
|
||||||
<span className={clsx(
|
<span className={clsx(
|
||||||
'absolute top-2.5 right-0 w-8',
|
'absolute top-2.5 right-0 w-8',
|
||||||
'flex items-center justify-center translate-y-[2px]',
|
'flex items-center justify-center translate-y-[2px]',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user