-
Notifications
You must be signed in to change notification settings - Fork 24
Closed as not planned
Labels
status: on holdThe issue is currently not prioritized.The issue is currently not prioritized.
Description
User story
Part of #2824
As a merchant, I want to be able to paginate through the price benchmark table data.
Figma link
Acceptance criteria
- The
Pagination
component should allow users to paginate through a set of data. - The table should show 10 products per page.
Implementation brief
- Custom pagination logic should be added to work with Google's token based pagination compared to the default offset based pagination of
DataViews
- Create
js/src/pages/price-benchmark/pagination/index.js
which houses thePagination
component and it should render the same markup as theDataViews
pagination buttons.- It accepts the following props:
hasNextPage
: booleanhasPrevPage
: booleanonPreviousPageClick
: callback functiononNextPageClick
: callback function
- It accepts the following props:
- Within
PriceBenchmarkSuggestionsTable
andPriceBenchmarkAdjustmentsTable
,- Add the following state variables:
nextToken
: (string) to store the next tokenpreviousTokens
: array to store all the previous tokenscurrentPage
: integer to know which token index is currently being used
- Render the
Pagination
componentonPreviousPageClick
callback should fetch data based on the previous token (determined fromcurrentPage
)onNextPageClick
callback should add the current token to the list of previous tokens and then fetch data with the new token.- The selector returning the data should also return a
next_page_token
property which will be used to determine if there are additional results, i.ehasNextPage
.
- The selector returning the data should also return a
totalItems
andtotalPages
should be set to0
for thepaginationInfo
prop ofDataViews
to prevent the defaultDataViews
pagination from being rendered. ThefilterSortAndPaginate
function cannot be used.- Consider adding a placeholder/animation when new data is being fetched.
- Add the following state variables:
- Create
Out of bounds/rabbit holes
Test coverage
- Appropriate E2E tests should be added for the following features:
- data pagination, i.e correct set of data is loading when clicking the "Previous" and "Next" buttons.
Metadata
Metadata
Assignees
Labels
status: on holdThe issue is currently not prioritized.The issue is currently not prioritized.