feat(ui): just fetch all boards instead of paginating them

This commit is contained in:
psychedelicious 2023-06-21 18:10:26 +10:00
parent bd533426fc
commit abd6561140

View File

@ -21,7 +21,7 @@ import { OverlayScrollbarsComponent } from 'overlayscrollbars-react';
import AddBoardButton from './AddBoardButton';
import AllImagesBoard from './AllImagesBoard';
import { CloseIcon } from '@chakra-ui/icons';
import { useListBoardsQuery } from 'services/apiSlice';
import { useListAllBoardsQuery } from 'services/apiSlice';
const selector = createSelector(
[selectBoardsAll, boardsSelector],
@ -44,15 +44,14 @@ const BoardsList = (props: Props) => {
const { isOpen } = props;
const dispatch = useAppDispatch();
const { selectedBoardId, searchText } = useAppSelector(selector);
// const filteredBoards = useSelector(searchBoardsSelector);
const { data } = useListBoardsQuery({ offset: 0, limit: 8 });
const { data: boards } = useListAllBoardsQuery();
const filteredBoards = searchText
? data?.items.filter((board) =>
? boards?.filter((board) =>
board.board_name.toLowerCase().includes(searchText.toLowerCase())
)
: data?.items;
: boards;
const [searchMode, setSearchMode] = useState(false);