Remove optional chaining from server
This commit is contained in:
parent
0f2b50b9f1
commit
bc26925c2f
|
@ -266,13 +266,15 @@ exports.checkForViewUpdates = async (db, table, rename, deletedColumns) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update filters if required
|
// Update filters if required
|
||||||
view.meta.filters?.forEach(filter => {
|
if (view.meta.filters) {
|
||||||
|
view.meta.filters.forEach(filter => {
|
||||||
if (filter.key === rename.old) {
|
if (filter.key === rename.old) {
|
||||||
filter.key = rename.updated
|
filter.key = rename.updated
|
||||||
needsUpdated = true
|
needsUpdated = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else if (deletedColumns?.length) {
|
}
|
||||||
|
} else if (deletedColumns) {
|
||||||
deletedColumns.forEach(column => {
|
deletedColumns.forEach(column => {
|
||||||
// Remove calculation statement if required
|
// Remove calculation statement if required
|
||||||
if (view.meta.field === column) {
|
if (view.meta.field === column) {
|
||||||
|
@ -289,7 +291,7 @@ exports.checkForViewUpdates = async (db, table, rename, deletedColumns) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove filters referencing deleted field if required
|
// Remove filters referencing deleted field if required
|
||||||
if (view.meta.filters?.length) {
|
if (view.meta.filters && view.meta.filters.length) {
|
||||||
const initialLength = view.meta.filters.length
|
const initialLength = view.meta.filters.length
|
||||||
view.meta.filters = view.meta.filters.filter(filter => {
|
view.meta.filters = view.meta.filters.filter(filter => {
|
||||||
return filter.key !== column
|
return filter.key !== column
|
||||||
|
|
Loading…
Reference in New Issue