fix: userSettings not getting updated if dont for the first time
This commit is contained in:
parent
bfc72bfb6e
commit
e8e25525f1
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="flex flex-col text-base">
|
||||
<div class="flex flex-col flex-1 text-base">
|
||||
<div v-if="label" class="mb-1.5 text-sm text-ink-gray-5">
|
||||
{{ __(label) }}
|
||||
</div>
|
||||
@ -244,6 +244,7 @@ const props = defineProps({
|
||||
const { getGridViewSettings, getFields, getGridSettings } = getMeta(
|
||||
props.doctype,
|
||||
)
|
||||
getMeta(props.parentDoctype)
|
||||
|
||||
const rows = defineModel()
|
||||
const showRowList = ref(new Array(rows.value?.length || []).fill(false))
|
||||
|
||||
@ -107,7 +107,7 @@ const props = defineProps({
|
||||
parentDoctype: String,
|
||||
})
|
||||
|
||||
const { userSettings, getFields, getGridViewSettings, saveUserSettings } = getMeta(
|
||||
const { getFields, getGridViewSettings, saveUserSettings } = getMeta(
|
||||
props.doctype,
|
||||
)
|
||||
|
||||
@ -175,14 +175,6 @@ function update() {
|
||||
saveUserSettings(props.parentDoctype, 'GridView', updateFields, () => {
|
||||
loading.value = false
|
||||
show.value = false
|
||||
if (userSettings[props.parentDoctype]?.['GridView']) {
|
||||
userSettings[props.parentDoctype]['GridView'][props.doctype] =
|
||||
updateFields
|
||||
} else {
|
||||
userSettings[props.parentDoctype] = {
|
||||
GridView: { [props.doctype]: updateFields },
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@ export function getMeta(doctype) {
|
||||
}
|
||||
|
||||
function saveUserSettings(parentDoctype, key, value, callback) {
|
||||
let oldUserSettings = userSettings[parentDoctype]
|
||||
let oldUserSettings = userSettings[parentDoctype] || {}
|
||||
let newUserSettings = JSON.parse(JSON.stringify(oldUserSettings))
|
||||
|
||||
if (newUserSettings[key] === undefined) {
|
||||
@ -98,9 +98,13 @@ export function getMeta(doctype) {
|
||||
user_settings: JSON.stringify(newUserSettings),
|
||||
},
|
||||
auto: true,
|
||||
onSuccess: () => callback?.(),
|
||||
onSuccess: () => {
|
||||
userSettings[parentDoctype] = newUserSettings
|
||||
callback?.()
|
||||
},
|
||||
})
|
||||
}
|
||||
userSettings[parentDoctype] = newUserSettings
|
||||
return callback?.()
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user