fix: resolved more caching issues
This commit is contained in:
parent
e74647c225
commit
1fc0e74098
@ -150,7 +150,7 @@ onMounted(() => {
|
||||
|
||||
const filters = computed(() => {
|
||||
if (!list.value?.data) return new Set()
|
||||
let allFilters = list.value?.params?.filters
|
||||
let allFilters = list.value.data?.params?.filters
|
||||
if (!allFilters || !filterableFields.data) return new Set()
|
||||
// remove default filters
|
||||
if (props.default_filters) {
|
||||
|
||||
@ -131,7 +131,7 @@ onMounted(() => {
|
||||
const sortValues = computed({
|
||||
get: () => {
|
||||
if (!list.value?.data) return new Set()
|
||||
let allSortValues = list.value?.params?.order_by
|
||||
let allSortValues = list.value.data?.params?.order_by
|
||||
if (!allSortValues || !sortOptions.data) return new Set()
|
||||
if (allSortValues.trim() === 'modified desc') return new Set()
|
||||
allSortValues = allSortValues.split(', ').map((sortValue) => {
|
||||
|
||||
@ -87,6 +87,7 @@ import { usersStore } from '@/stores/users'
|
||||
import { createResource, Dropdown, call, FeatherIcon } from 'frappe-ui'
|
||||
import { computed, ref, defineModel, onMounted, watch, h } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { useDebounceFn } from '@vueuse/core'
|
||||
|
||||
const props = defineProps({
|
||||
doctype: {
|
||||
@ -207,15 +208,21 @@ list.value = createResource({
|
||||
url: 'crm.api.doc.get_list_data',
|
||||
params: getParams(),
|
||||
cache: [props.doctype, route.query.view],
|
||||
transform(data) {
|
||||
return {
|
||||
...data,
|
||||
params: getParams(),
|
||||
}
|
||||
},
|
||||
onSuccess(data) {
|
||||
let cv = getView(route.query.view)
|
||||
|
||||
let params = getParams()
|
||||
defaultParams.value = {
|
||||
doctype: props.doctype,
|
||||
filters: list.value.params.filters,
|
||||
order_by: list.value.params.order_by,
|
||||
page_length: list.value.params.page_length,
|
||||
page_length_count: list.value.params.page_length_count,
|
||||
filters: params.filters,
|
||||
order_by: params.order_by,
|
||||
page_length: params.page_length,
|
||||
page_length_count: params.page_length_count,
|
||||
columns: data.columns,
|
||||
rows: data.rows,
|
||||
custom_view_name: cv?.name || '',
|
||||
@ -224,6 +231,13 @@ list.value = createResource({
|
||||
},
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
useDebounceFn(() => {
|
||||
if (list.value?.data?.data?.length) return
|
||||
list.value.fetch()
|
||||
}, 100)()
|
||||
})
|
||||
|
||||
const isLoading = computed(() => list.value?.loading)
|
||||
|
||||
function reload() {
|
||||
@ -321,6 +335,9 @@ function updateSort(order_by) {
|
||||
}
|
||||
|
||||
function updateColumns(obj) {
|
||||
if (!defaultParams.value) {
|
||||
defaultParams.value = getParams()
|
||||
}
|
||||
defaultParams.value.columns = view.value.columns = obj.isDefault
|
||||
? ''
|
||||
: obj.columns
|
||||
@ -362,7 +379,11 @@ function updatePageLength(value, loadMore = false) {
|
||||
if (loadMore) {
|
||||
list.value.params.page_length += list.value.params.page_length_count
|
||||
} else {
|
||||
if (value == list.value.params.page_length && value == list.value.params.page_length_count) return
|
||||
if (
|
||||
value == list.value.params.page_length &&
|
||||
value == list.value.params.page_length_count
|
||||
)
|
||||
return
|
||||
list.value.params.page_length = value
|
||||
list.value.params.page_length_count = value
|
||||
}
|
||||
|
||||
@ -25,6 +25,10 @@ export const usersStore = defineStore('crm-users', () => {
|
||||
},
|
||||
})
|
||||
|
||||
if (!users.data?.length) {
|
||||
users.fetch()
|
||||
}
|
||||
|
||||
function getUser(email) {
|
||||
if (!email || email === 'sessionUser') {
|
||||
email = session.user
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user