1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-19 17:52:45 +02:00

fix: pagination limit and placeholder (#10533)

This commit is contained in:
Mateusz Kwasniewski 2025-08-26 14:39:03 +02:00 committed by GitHub
parent ac11af8c05
commit f375ae4694
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import type React from 'react'; import type React from 'react';
import { useEffect } from 'react';
import { Box, Typography, Button, styled } from '@mui/material'; import { Box, Typography, Button, styled } from '@mui/material';
import { ConditionallyRender } from '../../ConditionallyRender/ConditionallyRender.tsx'; import { ConditionallyRender } from '../../ConditionallyRender/ConditionallyRender.tsx';
import { ReactComponent as ArrowRight } from 'assets/icons/arrowRight.svg'; import { ReactComponent as ArrowRight } from 'assets/icons/arrowRight.svg';
@ -60,6 +61,12 @@ export const PaginationBar: React.FC<PaginationBarProps> = ({
fetchNextPage, fetchNextPage,
setPageLimit, setPageLimit,
}) => { }) => {
useEffect(() => {
if (![25, 50, 75, 100].includes(pageSize)) {
setPageLimit(25);
}
}, [pageSize]);
const itemRange = const itemRange =
totalItems !== undefined && pageSize && totalItems > 1 totalItems !== undefined && pageSize && totalItems > 1
? `${pageIndex * pageSize + 1}-${Math.min( ? `${pageIndex * pageSize + 1}-${Math.min(

View File

@ -151,7 +151,7 @@ export const ProjectFeatureToggles = ({
setShowFeatureDeleteDialogue, setShowFeatureDeleteDialogue,
} = useRowActions(refetch, projectId, trackArchiveAction); } = useRowActions(refetch, projectId, trackArchiveAction);
const isPlaceholder = Boolean(initialLoad || (loading && total)); const isPlaceholder = Boolean(initialLoad || loading);
const [onboardingFlow, setOnboardingFlow] = useLocalStorageState< const [onboardingFlow, setOnboardingFlow] = useLocalStorageState<
'visible' | 'closed' 'visible' | 'closed'