Skip to content

Commit

Permalink
WCMS-19554: Fix pagination Bugs (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
brdunfield authored Aug 27, 2024
1 parent 12cef31 commit 46da3ee
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 1 addition & 3 deletions src/components/DataDictionaryTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ const DataDictionaryTable = ({tableColumns, tableData, pageSize, columnFilters}
evt.preventDefault();
table.setPageIndex(page - 1)
}}
renderHref={(page) => {
return '';
}}
renderHref={(page) => `/page=${page}`}
/>
): ''}
</div>
Expand Down
6 changes: 2 additions & 4 deletions src/components/DatasetTableTab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,13 @@ const DatasetTable = ({isModal = false, closeFullScreenModal} : {isModal?: boole
<div className="ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end ds-u-md-justify-content--between ds-u-margin-top--2 ds-u-align-items--center">
<Pagination
totalPages={Math.ceil(resource.count ? resource.count / pageSize : 1)}
currentPage={page}
currentPage={Number(page)}
onPageChange={(evt, page) => {
evt.preventDefault();
setOffset((page - 1) * limit);
setPage(page);
}}
renderHref={(page) => {
return '';
}}
renderHref={(p) => `?page=${p}`}
className="ds-l-col--12 ds-u-padding-x--0"
/>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/templates/DatasetSearch/DatasetSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ const DatasetSearch = (props: DatasetSearchPageProps) => {
}, [totalItems, pageSize, page]);

useEffect(() => {
setPage(1)
if (page !== 1 && (transformedParams.fulltext !== fulltext || transformedParams.selectedFacets !== selectedFacets))
setPage(1)
}, [fulltext, selectedFacets]);

useEffect(() => {
Expand Down

0 comments on commit 46da3ee

Please sign in to comment.