Skip to content

Commit

Permalink
fix(xo-web): changing items per page should select page 1
Browse files Browse the repository at this point in the history
Fixes #7350
  • Loading branch information
julien-f committed Feb 7, 2024
1 parent 83a94ee commit 287378f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [Import/VMWare] Fix `(Failure \"Expected string, got 'I(0)'\")` (PR [#7361](https://github.com/vatesfr/xen-orchestra/issues/7361))
- [Plugin/load-balancer] Fixing `TypeError: Cannot read properties of undefined (reading 'high')` happening when trying to optimize a host with performance plan [#7359](https://github.com/vatesfr/xen-orchestra/issues/7359) (PR [#7362](https://github.com/vatesfr/xen-orchestra/pull/7362))
- Changing the number of displayed items per page should send back to the first page [#7350](https://github.com/vatesfr/xen-orchestra/issues/7350)

### Packages to release

Expand All @@ -32,5 +33,6 @@

- xo-server patch
- xo-server-load-balancer patch
- xo-web patch

<!--packages-end-->
5 changes: 5 additions & 0 deletions packages/xo-web/src/common/sorted-table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,11 @@ class SortedTable extends Component {
const { location, stateUrlParam } = this.props
this.setState({ itemsPerPage })
cookies.set(`${location.pathname}-${stateUrlParam}`, itemsPerPage)

// changing the number of items per page should send back to the first page
//
// see https://github.com/vatesfr/xen-orchestra/issues/7350
this._setPage(1)
}

render() {
Expand Down
5 changes: 5 additions & 0 deletions packages/xo-web/src/xo-app/home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,11 @@ export default class Home extends Component {
_setNItemsPerPage(nItems) {
this.setState({ homeItemsPerPage: nItems })
cookies.set('homeItemsPerPage', nItems)

// changing the number of items per page should send back to the first page
//
// see https://github.com/vatesfr/xen-orchestra/issues/7350
this._onPageSelection(1)
}

_getPage() {
Expand Down

0 comments on commit 287378f

Please sign in to comment.