1
0
Fork 0
mirror of synced 2024-09-08 13:41:09 +12:00

Fixing a regression of CSV table creation - normally if a CSV was used to create a table with an options column all of the options would be filled in but this had been broken.

This commit is contained in:
mike12345567 2022-10-04 17:54:33 +01:00
parent d8e95a4588
commit 1dabc59ff5
3 changed files with 12 additions and 4 deletions

View file

@ -22,7 +22,7 @@ export async function addRev(
}
/**
* Performs a case insensitive search on the provided documents, using the
* Performs a case in-sensitive search on the provided documents, using the
* provided key and value. This will be a string based search, using the
* startsWith function.
*/

View file

@ -14,8 +14,10 @@ import {
fixAutoColumnSubType,
} from "../../../utilities/rowProcessor"
import { runStaticFormulaChecks } from "./bulkFormula"
import { Table } from "../../../definitions/common"
import { Table } from "@budibase/types"
import { quotas } from "@budibase/pro"
import { isEqual } from "lodash"
import { cloneDeep } from "lodash/fp"
function checkAutoColumns(table: Table, oldTable: Table) {
if (!table.schema) {
@ -123,10 +125,16 @@ export async function save(ctx: any) {
if (updatedRows && updatedRows.length !== 0) {
await db.bulkDocs(updatedRows)
}
const result = await db.put(tableToSave)
let result = await db.put(tableToSave)
tableToSave._rev = result.rev
const savedTable = cloneDeep(tableToSave)
tableToSave = await tableSaveFunctions.after(tableToSave)
// the table may be updated as part of the table save after functionality - need to write it
if (!isEqual(savedTable, tableToSave)) {
result = await db.put(tableToSave)
tableToSave._rev = result.rev
}
// has to run after, make sure it has _id
await runStaticFormulaChecks(tableToSave, { oldTable, deletion: null })
return tableToSave

View file

@ -245,7 +245,7 @@ class TableSaveFunctions {
// after saving
async after(table: any) {
table = await handleSearchIndexes(table)
await handleDataImport(this.user, table, this.dataImport)
table = await handleDataImport(this.user, table, this.dataImport)
return table
}