clear out boards search when adding a new board

This commit is contained in:
chainchompa 2024-07-09 14:31:40 -04:00 committed by Kent Keirsey
parent f193a576a6
commit cdacf2ecd0
2 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,6 @@
import { IconButton } from '@invoke-ai/ui-library'; import { IconButton } from '@invoke-ai/ui-library';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { boardIdSelected } from 'features/gallery/store/gallerySlice'; import { boardIdSelected, boardSearchTextChanged } from 'features/gallery/store/gallerySlice';
import { memo, useCallback, useMemo } from 'react'; import { memo, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { PiPlusBold } from 'react-icons/pi'; import { PiPlusBold } from 'react-icons/pi';
@ -24,10 +24,12 @@ const AddBoardButton = ({ isPrivateBoard }: Props) => {
} }
return t('boards.addSharedBoard'); return t('boards.addSharedBoard');
}, [allowPrivateBoards, isPrivateBoard, t]); }, [allowPrivateBoards, isPrivateBoard, t]);
const handleCreateBoard = useCallback(async () => { const handleCreateBoard = useCallback(async () => {
try { try {
const board = await createBoard({ board_name: t('boards.myBoard'), is_private: isPrivateBoard }).unwrap(); const board = await createBoard({ board_name: t('boards.myBoard'), is_private: isPrivateBoard }).unwrap();
dispatch(boardIdSelected({ boardId: board.board_id })); dispatch(boardIdSelected({ boardId: board.board_id }));
dispatch(boardSearchTextChanged(''));
} catch { } catch {
//no-op //no-op
} }

View File

@ -10,10 +10,10 @@ import { PiImagesBold, PiMagnifyingGlassBold } from 'react-icons/pi';
import BoardsList from './Boards/BoardsList/BoardsList'; import BoardsList from './Boards/BoardsList/BoardsList';
import GalleryBoardName from './GalleryBoardName'; import GalleryBoardName from './GalleryBoardName';
import GallerySettingsPopover from './GallerySettingsPopover/GallerySettingsPopover';
import GalleryImageGrid from './ImageGrid/GalleryImageGrid'; import GalleryImageGrid from './ImageGrid/GalleryImageGrid';
import { GalleryPagination } from './ImageGrid/GalleryPagination'; import { GalleryPagination } from './ImageGrid/GalleryPagination';
import { GallerySearch } from './ImageGrid/GallerySearch'; import { GallerySearch } from './ImageGrid/GallerySearch';
import GallerySettingsPopover from './GallerySettingsPopover/GallerySettingsPopover';
const baseStyles: ChakraProps['sx'] = { const baseStyles: ChakraProps['sx'] = {
fontWeight: 'semibold', fontWeight: 'semibold',