diff --git a/src/components/DelegatesTable/DelegatesTable.vue b/src/components/DelegatesTable/DelegatesTable.vue index 6ba227fd1..c88605d26 100644 --- a/src/components/DelegatesTable/DelegatesTable.vue +++ b/src/components/DelegatesTable/DelegatesTable.vue @@ -96,10 +96,10 @@ export default defineComponent({ const startIndex = (page.value - 1) * perPage.value const endIndex = startIndex + perPage.value - const delegatesOnCurrentPage = delegates.value.slice(startIndex, endIndex) - const filteredDelegates = [...delegatesOnCurrentPage] + const filteredDelegates = [...delegates.value] .sort(sortDelegatesByColumnCompareFn(sortBy.value)) .filter(filterDelegatesFn(searchQuery.value)) + .slice(startIndex, endIndex) return reactive(filteredDelegates) }) diff --git a/src/views/Votes.vue b/src/views/Votes.vue index b9fe2ed0c..167b669ca 100644 --- a/src/views/Votes.vue +++ b/src/views/Votes.vue @@ -87,7 +87,7 @@ import AppToolbarCentered from '@/components/AppToolbarCentered.vue' import Pagination from '@/components/Pagination.vue' import DelegatesTable from '@/components/DelegatesTable/DelegatesTable.vue' -import { computed, onMounted, ref, reactive, defineComponent } from 'vue' +import { computed, onMounted, ref, reactive, defineComponent, watch } from 'vue' import { useStore } from 'vuex' import { useI18n } from 'vue-i18n' @@ -134,6 +134,12 @@ export default defineComponent({ return Math.ceil(delegates.value.length / pagination.rowsPerPage) }) + watch(search, (newValue) => { + if (newValue.length > 0) { + pagination.page = 1 + } + }) + const showPagination = computed(() => search.value.length === 0) const reviewButtonDisabled = computed(() => { return numOfUpvotes.value + numOfDownvotes.value === 0