diff --git a/htmlui/src/SnapshotsTable.js b/htmlui/src/SnapshotsTable.js
index 4adf0d03e..24eecaf5b 100644
--- a/htmlui/src/SnapshotsTable.js
+++ b/htmlui/src/SnapshotsTable.js
@@ -35,7 +35,6 @@ export class SnapshotsTable extends Component {
snapshots: [],
showHidden: false,
isLoading: false,
- forceFirstPage: false,
error: null,
};
this.onChange = this.onChange.bind(this);
@@ -95,7 +94,6 @@ export class SnapshotsTable extends Component {
onChange(x) {
this.setState({
showHidden: x.target.checked,
- forceFirstPage: true,
});
}
@@ -109,14 +107,6 @@ export class SnapshotsTable extends Component {
return ;
}
- const willForceFirstPage = this.state.forceFirstPage;
-
- if (this.state.forceFirstPage) {
- this.setState({
- forceFirstPage: false,
- })
- }
-
snapshots.sort((a, b) => -compare(a.startTime, b.startTime));
let { filteredSnapshots, hiddenCount } = this.coalesceSnapshots(snapshots);
@@ -171,7 +161,7 @@ export class SnapshotsTable extends Component {
-
+
;
}
diff --git a/htmlui/src/Table.js b/htmlui/src/Table.js
index 659578886..20b8365a8 100644
--- a/htmlui/src/Table.js
+++ b/htmlui/src/Table.js
@@ -44,7 +44,7 @@ function paginationItems(count, active, gotoPage) {
return items;
}
-export default function MyTable({ columns, data, forceFirstPage }) {
+export default function MyTable({ columns, data }) {
// Use the state and functions returned from useTable to build your UI
const {
getTableProps,
@@ -71,8 +71,8 @@ export default function MyTable({ columns, data, forceFirstPage }) {
usePagination,
)
- if (forceFirstPage && pageIndex !== 0) {
- gotoPage(0);
+ if (pageIndex >= pageCount && pageIndex !== 0 && pageCount > 0) {
+ gotoPage(pageCount - 1);
}
const paginationUI = pageOptions.length > 1 &&