Skip to content

Commit

Permalink
fix: set userSettings if does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
shariquerik committed Dec 29, 2024
1 parent 2ffd729 commit bd3c685
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 3 additions & 1 deletion frontend/src/components/Controls/Grid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/components/Controls/GridFieldsEditorModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
}
}
})
}
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/stores/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit bd3c685

Please sign in to comment.