perf: reset pageNumber when changing filters to prevent value overflow (#591) @Larsluph

This commit is contained in:
Rémi Marseault 2023-01-06 10:08:24 +01:00 committed by GitHub
parent 5132d4decf
commit 719c5e9eba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -271,6 +271,11 @@ export default {
watch: {
torrents: function (torrents) {
this.$store.commit('SET_CURRENT_ITEM_COUNT', torrents.length)
const pageCount = Math.ceil( torrents.length / this.paginationSize);
if (pageCount < this.pageNumber) {
this.pageNumber = Math.max(1, pageCount)
}
}
},
mounted() {