Cloning table schema to avoid mutation.

This commit is contained in:
mike12345567 2023-08-14 11:19:00 +01:00
parent 672e370904
commit 97e5fe37a1
1 changed files with 2 additions and 2 deletions

View File

@ -1,11 +1,11 @@
import {
FieldSchema,
RenameColumn,
TableSchema,
View,
ViewV2,
} from "@budibase/types"
import { context, HTTPError } from "@budibase/backend-core"
import { cloneDeep } from "lodash"
import sdk from "../../../sdk"
import * as utils from "../../../db/utils"
@ -78,7 +78,7 @@ export function enrichSchema(view: View | ViewV2, tableSchema: TableSchema) {
return view
}
let schema = { ...tableSchema }
let schema = cloneDeep(tableSchema)
const anyViewOrder = Object.values(view.schema || {}).some(
ui => ui.order != null
)