multiple: set pagination defaults
Set pagination defaults, otherwise these might be `undefined`.
This commit is contained in:
parent
bad77421ae
commit
4125a9cd3b
8 changed files with 36 additions and 15 deletions
|
|
@ -24,7 +24,11 @@ import { Link } from 'react-router-dom';
|
|||
import BlueprintCard from './BlueprintCard';
|
||||
import BlueprintsPagination from './BlueprintsPagination';
|
||||
|
||||
import { DEBOUNCED_SEARCH_WAIT_TIME } from '../../constants';
|
||||
import {
|
||||
DEBOUNCED_SEARCH_WAIT_TIME,
|
||||
PAGINATION_OFFSET,
|
||||
PAGINATION_LIMIT,
|
||||
} from '../../constants';
|
||||
import { useGetBlueprintsQuery } from '../../store/backendApi';
|
||||
import {
|
||||
selectBlueprintSearchInput,
|
||||
|
|
@ -55,8 +59,8 @@ type emptyBlueprintStateProps = {
|
|||
const BlueprintsSidebar = () => {
|
||||
const selectedBlueprintId = useAppSelector(selectSelectedBlueprintId);
|
||||
const blueprintSearchInput = useAppSelector(selectBlueprintSearchInput);
|
||||
const blueprintsOffset = useAppSelector(selectOffset);
|
||||
const blueprintsLimit = useAppSelector(selectLimit);
|
||||
const blueprintsOffset = useAppSelector(selectOffset) || PAGINATION_OFFSET;
|
||||
const blueprintsLimit = useAppSelector(selectLimit) || PAGINATION_LIMIT;
|
||||
const {
|
||||
data: blueprintsData,
|
||||
isLoading,
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import {
|
|||
useDeleteBlueprintMutation,
|
||||
useGetBlueprintsQuery,
|
||||
} from '../../store/imageBuilderApi';
|
||||
import { PAGINATION_LIMIT, PAGINATION_OFFSET } from '../../constants';
|
||||
|
||||
interface DeleteBlueprintModalProps {
|
||||
setShowDeleteModal: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
|
|
@ -31,8 +32,8 @@ export const DeleteBlueprintModal: React.FunctionComponent<
|
|||
> = ({ setShowDeleteModal, isOpen }: DeleteBlueprintModalProps) => {
|
||||
const selectedBlueprintId = useAppSelector(selectSelectedBlueprintId);
|
||||
const blueprintSearchInput = useAppSelector(selectBlueprintSearchInput);
|
||||
const blueprintsOffset = useAppSelector(selectOffset);
|
||||
const blueprintsLimit = useAppSelector(selectLimit);
|
||||
const blueprintsOffset = useAppSelector(selectOffset) || PAGINATION_OFFSET;
|
||||
const blueprintsLimit = useAppSelector(selectLimit) || PAGINATION_LIMIT;
|
||||
const dispatch = useAppDispatch();
|
||||
const { blueprintName } = useGetBlueprintsQuery(
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue