Skip to content

Commit

Permalink
fix(ktabledata): move code up
Browse files Browse the repository at this point in the history
  • Loading branch information
Justineo committed Nov 28, 2024
1 parent c708874 commit 81bfa43
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/components/KTableData/KTableData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,15 @@ const getCellSlots = computed((): string[] => {
return Object.keys(slots).filter((slot) => tableHeaders.value.some((header) => header.key === slot))
})
const fetcherParams = computed(() => ({
pageSize: pageSize.value,
page: page.value,
query: props.searchInput || filterQuery.value,
sortColumnKey: sortColumnKey.value,
sortColumnOrder: sortColumnOrder.value,
offset: offset.value,
}))
const isInitialFetch = ref<boolean>(true)
const fetchData = async () => {
const res = await props.fetcher(fetcherParams.value)
Expand Down Expand Up @@ -369,15 +378,6 @@ const initData = () => {
const previousOffset = computed((): string | null => offsets.value[page.value - 1])
const nextOffset = ref<string | null>(null)
const fetcherParams = computed(() => ({
pageSize: pageSize.value,
page: page.value,
query: props.searchInput || filterQuery.value,
sortColumnKey: sortColumnKey.value,
sortColumnOrder: sortColumnOrder.value,
offset: offset.value,
}))
// once initData() finishes, setting tableFetcherCacheKey to non-falsey value triggers fetch of data
const tableFetcherCacheKey = computed((): string => {
if (!props.fetcher || !hasInitialized.value) {
Expand Down

0 comments on commit 81bfa43

Please sign in to comment.