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 { 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 { useTranslation } from 'react-i18next';
import { PiPlusBold } from 'react-icons/pi';
@ -24,10 +24,12 @@ const AddBoardButton = ({ isPrivateBoard }: Props) => {
}
return t('boards.addSharedBoard');
}, [allowPrivateBoards, isPrivateBoard, t]);
const handleCreateBoard = useCallback(async () => {
try {
const board = await createBoard({ board_name: t('boards.myBoard'), is_private: isPrivateBoard }).unwrap();
dispatch(boardIdSelected({ boardId: board.board_id }));
dispatch(boardSearchTextChanged(''));
} catch {
//no-op
}

View File

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