fix: set userSettings if does not exist
This commit is contained in:
parent
2ffd729ece
commit
25d03c5b12
@ -251,7 +251,9 @@ const fields = computed(() => {
|
||||
)
|
||||
return d
|
||||
}
|
||||
return gridFields?.map((f) => getFieldObj(f)) || []
|
||||
return (
|
||||
gridFields?.filter((f) => f.in_list_view).map((f) => getFieldObj(f)) || []
|
||||
)
|
||||
})
|
||||
|
||||
function getFieldObj(field) {
|
||||
|
||||
@ -176,7 +176,14 @@ function update() {
|
||||
saveUserSettings(props.parentDoctype, 'GridView', updateFields, () => {
|
||||
loading.value = false
|
||||
show.value = false
|
||||
userSettings[props.parentDoctype]['GridView'][props.doctype] = updateFields
|
||||
if (userSettings[props.parentDoctype]?.['GridView']) {
|
||||
userSettings[props.parentDoctype]['GridView'][props.doctype] =
|
||||
updateFields
|
||||
} else {
|
||||
userSettings[props.parentDoctype] = {
|
||||
GridView: { [props.doctype]: updateFields },
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -80,7 +80,11 @@ export function getMeta(doctype) {
|
||||
let oldUserSettings = userSettings[parentDoctype]
|
||||
let newUserSettings = JSON.parse(JSON.stringify(oldUserSettings))
|
||||
|
||||
newUserSettings[key][doctype] = value
|
||||
if (newUserSettings[key] === undefined) {
|
||||
newUserSettings[key] = { [doctype]: value }
|
||||
} else {
|
||||
newUserSettings[key][doctype] = value
|
||||
}
|
||||
|
||||
if (JSON.stringify(oldUserSettings) !== JSON.stringify(newUserSettings)) {
|
||||
return createResource({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user