diff --git a/src/components/Comparison/Comparison.tsx b/src/components/Comparison/Comparison.tsx index e4f6066b..693e75a8 100644 --- a/src/components/Comparison/Comparison.tsx +++ b/src/components/Comparison/Comparison.tsx @@ -29,6 +29,14 @@ export const Comparison = () => { }; const handleRemoveComparisonItem = (id: string) => { + if (currentPage === totalPages - 1) { + setCurrentPage(prevValue => { + const previousPage = prevValue - 1; + + return previousPage >= 0 ? previousPage : 0; + }); + } + setPreviewContent(prev => prev.filter(({ id: prevId }) => prevId !== id)); setSelectedInstances(prev => prev.filter(prevId => prevId !== id)); }; @@ -79,7 +87,7 @@ export const Comparison = () => {