Cloning table schema to avoid mutation.
This commit is contained in:
parent
672e370904
commit
97e5fe37a1
|
@ -1,11 +1,11 @@
|
||||||
import {
|
import {
|
||||||
FieldSchema,
|
|
||||||
RenameColumn,
|
RenameColumn,
|
||||||
TableSchema,
|
TableSchema,
|
||||||
View,
|
View,
|
||||||
ViewV2,
|
ViewV2,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { context, HTTPError } from "@budibase/backend-core"
|
import { context, HTTPError } from "@budibase/backend-core"
|
||||||
|
import { cloneDeep } from "lodash"
|
||||||
|
|
||||||
import sdk from "../../../sdk"
|
import sdk from "../../../sdk"
|
||||||
import * as utils from "../../../db/utils"
|
import * as utils from "../../../db/utils"
|
||||||
|
@ -78,7 +78,7 @@ export function enrichSchema(view: View | ViewV2, tableSchema: TableSchema) {
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
let schema = { ...tableSchema }
|
let schema = cloneDeep(tableSchema)
|
||||||
const anyViewOrder = Object.values(view.schema || {}).some(
|
const anyViewOrder = Object.values(view.schema || {}).some(
|
||||||
ui => ui.order != null
|
ui => ui.order != null
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue