A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
Fix page not changing with folder issue
aminnausin97fd279a4cfb
diff --git a/resources/js/components/table/TableBase.vue b/resources/js/components/table/TableBase.vueindex 035fcaee..2e69ed26 100755--- a/resources/js/components/table/TableBase.vue+++ b/resources/js/components/table/TableBase.vue@@ -9,7 +9,7 @@ import TablePagination from '../table/TablePagination.vue';import PhSortAscendingLight from '~icons/ph/sort-ascending-light';import PhSortDescendingLight from '~icons/ph/sort-descending-light';-import { ref, watch } from 'vue';+import { ref } from 'vue';const props = defineProps(['useToolbar','data', 'row', 'clickAction', 'loading', 'sortAction', 'sortingOptions', 'itemsPerPage','searchQuery', 'selectedID']);@@ -23,8 +23,6 @@ const handleSortChange = (sortKey) => {if (!lastSortKey.value) return;props.sortAction(lastSortKey.value, sortAscending.value ? 1 : -1);}--watch(props.data, tableData.handlePageReset, {immediate: true});</script><template>diff --git a/resources/js/composables/useTable.js b/resources/js/composables/useTable.jsindex 9cd02340..9bc83683 100755--- a/resources/js/composables/useTable.js+++ b/resources/js/composables/useTable.js@@ -5,17 +5,7 @@ export default function useTable(props){const itemsPerPage = ref(props.itemsPerPage ?? 10);const searchQuery = ref(props.searchQuery ?? '')- const handlePageChange = (page) => {- currentPage.value = page;- }-- const handlePageReset = () => {- currentPage.value = 1- };-- watch(props.data, handlePageReset, {immediate: true})-- return reactive({+ const table = reactive({filteredPage : computed(() => {const minIndex = itemsPerPage.value * (currentPage.value - 1);const maxIndex = Math.min(itemsPerPage.value * (currentPage.value), props.data.length);@@ -24,7 +14,15 @@ export default function useTable(props){}),props,fields: {currentPage, itemsPerPage, searchQuery},- handlePageChange,- handlePageReset+ handlePageChange (page) {+ currentPage.value = page;+ },+ handlePageReset () {+ currentPage.value = 1;+ },});++ watch(() => props.data, table.handlePageReset, {immediate: true})++ return table;}\ No newline at end of file