1
0
Fork 0
mirror of synced 2024-09-18 18:28:33 +12:00

Merge pull request #14097 from Budibase/fix/squash-oldrow-in-external-row-controller

Squash the oldRow prop in the external row controller
This commit is contained in:
deanhannigan 2024-07-05 11:23:31 +01:00 committed by GitHub
commit 581721caf7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 7 deletions

View file

@ -72,15 +72,23 @@ export async function patch(ctx: UserCtx<PatchRowRequest, PatchRowResponse>) {
const row = await sdk.rows.external.getRow(tableId, updatedId, {
relationships: true,
})
const enrichedRow = await outputProcessing(table, row, {
squash: true,
preserveLinks: true,
})
const [enrichedRow, oldRow] = await Promise.all([
outputProcessing(table, row, {
squash: true,
preserveLinks: true,
}),
outputProcessing(table, beforeRow, {
squash: true,
preserveLinks: true,
}),
])
return {
...response,
row: enrichedRow,
table,
oldRow: beforeRow,
oldRow,
}
}

View file

@ -7,7 +7,7 @@ import { automationQueue } from "./bullboard"
import { checkTestFlag } from "../utilities/redis"
import * as utils from "./utils"
import env from "../environment"
import { context, db as dbCore } from "@budibase/backend-core"
import { context, logging, db as dbCore } from "@budibase/backend-core"
import {
Automation,
Row,
@ -66,7 +66,11 @@ async function queueRelevantRowAutomations(
automationTrigger?.inputs &&
automationTrigger.inputs.tableId === event.row.tableId
) {
await automationQueue.add({ automation, event }, JOB_OPTS)
try {
await automationQueue.add({ automation, event }, JOB_OPTS)
} catch (e) {
logging.logAlert("Failed to queue automation", e)
}
}
}
})