Stringify non strings when pasting into text cells
This commit is contained in:
parent
2473b82ba5
commit
2ecedcea7c
|
@ -5,6 +5,7 @@ import { getCellID, parseCellID } from "../lib/utils"
|
||||||
import { tick } from "svelte"
|
import { tick } from "svelte"
|
||||||
import { Helpers } from "@budibase/bbui"
|
import { Helpers } from "@budibase/bbui"
|
||||||
import { sleep } from "../../../utils/utils"
|
import { sleep } from "../../../utils/utils"
|
||||||
|
import { FieldType } from "@budibase/types"
|
||||||
|
|
||||||
export const createStores = () => {
|
export const createStores = () => {
|
||||||
const rows = writable([])
|
const rows = writable([])
|
||||||
|
@ -421,8 +422,21 @@ export const createActions = context => {
|
||||||
// valid pending change was made or not
|
// valid pending change was made or not
|
||||||
const stashRowChanges = (rowId, changes) => {
|
const stashRowChanges = (rowId, changes) => {
|
||||||
const $rowLookupMap = get(rowLookupMap)
|
const $rowLookupMap = get(rowLookupMap)
|
||||||
|
const $columnLookupMap = get(columnLookupMap)
|
||||||
const row = $rowLookupMap[rowId]
|
const row = $rowLookupMap[rowId]
|
||||||
|
|
||||||
|
// Coerce some values into the correct types
|
||||||
|
for (let column of Object.keys(changes || {})) {
|
||||||
|
const type = $columnLookupMap[column]?.schema?.type
|
||||||
|
|
||||||
|
// Stringify objects
|
||||||
|
if (type === FieldType.STRING || type == FieldType.LONGFORM) {
|
||||||
|
if (changes[column] != null && typeof changes[column] !== "string") {
|
||||||
|
changes[column] = JSON.stringify(changes[column])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check this is a valid change
|
// Check this is a valid change
|
||||||
if (!row || !changesAreValid(row, changes)) {
|
if (!row || !changesAreValid(row, changes)) {
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in New Issue