Merge pull request #7364 from Budibase/bug/sev2/app-action-no-field-crash
Null safety for App Action no fields
This commit is contained in:
commit
f56e72dffd
|
@ -14,7 +14,7 @@
|
||||||
$: {
|
$: {
|
||||||
let fields = {}
|
let fields = {}
|
||||||
|
|
||||||
for (const [key, type] of Object.entries(block?.inputs?.fields)) {
|
for (const [key, type] of Object.entries(block?.inputs?.fields ?? {})) {
|
||||||
fields = {
|
fields = {
|
||||||
...fields,
|
...fields,
|
||||||
[key]: {
|
[key]: {
|
||||||
|
|
|
@ -125,6 +125,14 @@ const hasNullFilters = filters =>
|
||||||
|
|
||||||
exports.run = async function ({ inputs, appId }) {
|
exports.run = async function ({ inputs, appId }) {
|
||||||
const { tableId, filters, sortColumn, sortOrder, limit } = inputs
|
const { tableId, filters, sortColumn, sortOrder, limit } = inputs
|
||||||
|
if (!tableId) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
response: {
|
||||||
|
message: "You must select a table to query.",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
const table = await getTable(appId, tableId)
|
const table = await getTable(appId, tableId)
|
||||||
let sortType = FieldTypes.STRING
|
let sortType = FieldTypes.STRING
|
||||||
if (table && table.schema && table.schema[sortColumn] && sortColumn) {
|
if (table && table.schema && table.schema[sortColumn] && sortColumn) {
|
||||||
|
|
Loading…
Reference in New Issue