Merge branch '18029-fix-nan-pagination' into main. Closes #18029
authorStephen Smith <stephen@curii.com>
Fri, 10 Sep 2021 21:15:52 +0000 (17:15 -0400)
committerStephen Smith <stephen@curii.com>
Fri, 10 Sep 2021 21:15:52 +0000 (17:15 -0400)
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen@curii.com>

src/components/data-explorer/data-explorer.tsx
src/store/data-explorer/data-explorer-reducer.ts

index a38d0ed65ae3c03eb9affdd76a67cf423b2fbd60..d272e870bf0caaa46c7918624fe091265fb5c762 100644 (file)
@@ -134,6 +134,8 @@ export const DataExplorer = withStyles(styles)(
                             page={this.props.page}
                             onChangePage={this.changePage}
                             onChangeRowsPerPage={this.changeRowsPerPage}
+                            // Disable next button on empty lists since that's not default behavior
+                            nextIconButtonProps={(itemsAvailable > 0) ? {} : {disabled: true}}
                             component="div" /> : <Button
                                 variant="text"
                                 size="medium"
index c6aa7116b8de9d79341b0c56cdbc2f3d5a526b89..f67cccdcd48dc9eaea220c835149549d6dc871f6 100644 (file)
@@ -57,7 +57,7 @@ export const dataExplorerReducer = (state: DataExplorerState = {}, action: DataE
             update(state, id, mapColumns(setFilters(columnName, filters))),
 
         SET_ITEMS: ({ id, items, itemsAvailable, page, rowsPerPage }) =>
-            update(state, id, explorer => ({ ...explorer, items, itemsAvailable, page, rowsPerPage })),
+            update(state, id, explorer => ({ ...explorer, items, itemsAvailable, page: page || 0, rowsPerPage })),
 
         APPEND_ITEMS: ({ id, items, itemsAvailable, page, rowsPerPage }) =>
             update(state, id, explorer => ({