mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): do not focus board search on load
This commit is contained in:
parent
59437a02c3
commit
a24e63d440
@ -3,14 +3,13 @@ import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||
import { InvIconButton } from 'common/components/InvIconButton/InvIconButton';
|
||||
import { boardSearchTextChanged } from 'features/gallery/store/gallerySlice';
|
||||
import type { ChangeEvent, KeyboardEvent } from 'react';
|
||||
import { memo, useCallback, useEffect, useRef } from 'react';
|
||||
import { memo, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { PiXBold } from 'react-icons/pi';
|
||||
|
||||
const BoardsSearch = () => {
|
||||
const dispatch = useAppDispatch();
|
||||
const boardSearchText = useAppSelector((s) => s.gallery.boardSearchText);
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
const { t } = useTranslation();
|
||||
|
||||
const handleBoardSearch = useCallback(
|
||||
@ -41,18 +40,9 @@ const BoardsSearch = () => {
|
||||
[handleBoardSearch]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
// focus the search box on mount
|
||||
if (!inputRef.current) {
|
||||
return;
|
||||
}
|
||||
inputRef.current.focus();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<InputGroup>
|
||||
<Input
|
||||
ref={inputRef}
|
||||
placeholder={t('boards.searchBoard')}
|
||||
value={boardSearchText}
|
||||
onKeyDown={handleKeydown}
|
||||
|
Loading…
x
Reference in New Issue
Block a user