Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
SKarolFolio committed Jan 15, 2025
1 parent f67b2a6 commit 9fcb7b8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/Comparison/Comparison.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ export const Comparison = () => {

const handleRemoveComparisonItem = (id: string) => {
if (currentPage === totalPages - 1) {
setCurrentPage(prev => (prev - 1 >= 0 ? prev - 1 : 0));
setCurrentPage(prevValue => {
const previousPage = prevValue - 1;

return previousPage >= 0 ? previousPage : 0;
});
}

setPreviewContent(prev => prev.filter(({ id: prevId }) => prevId !== id));
Expand Down

0 comments on commit 9fcb7b8

Please sign in to comment.