mirror of
https://github.com/baptisteArno/typebot.io.git
synced 2026-06-19 21:04:33 +08:00
🚸 (googleSheets) Properly catch updateRow errors
This commit is contained in:
parent
a4358d6e21
commit
2597742521
@ -46,29 +46,29 @@ export const updateRow = async (
|
||||
workspaceId: state.workspaceId,
|
||||
});
|
||||
|
||||
await doc.loadInfo();
|
||||
const sheet = doc.sheetsById[Number(sheetId)];
|
||||
const rows = await sheet.getRows();
|
||||
const filteredRows = rows.filter((row) =>
|
||||
referenceCell
|
||||
? row.get(referenceCell.column as string) === referenceCell.value
|
||||
: matchFilter(row, filter as NonNullable<typeof filter>),
|
||||
);
|
||||
if (filteredRows.length === 0) {
|
||||
logs.push({
|
||||
status: "info",
|
||||
description: `Could not find any row that matches the filter`,
|
||||
details: JSON.stringify(filter),
|
||||
});
|
||||
return { outgoingEdgeId, logs };
|
||||
}
|
||||
|
||||
const parsedValues = parseNewCellValuesObject(variables)(
|
||||
options.cellsToUpsert,
|
||||
sheet.headerValues,
|
||||
);
|
||||
|
||||
try {
|
||||
await doc.loadInfo();
|
||||
const sheet = doc.sheetsById[Number(sheetId)];
|
||||
const rows = await sheet.getRows();
|
||||
const filteredRows = rows.filter((row) =>
|
||||
referenceCell
|
||||
? row.get(referenceCell.column as string) === referenceCell.value
|
||||
: matchFilter(row, filter as NonNullable<typeof filter>),
|
||||
);
|
||||
if (filteredRows.length === 0) {
|
||||
logs.push({
|
||||
status: "info",
|
||||
description: `Could not find any row that matches the filter`,
|
||||
details: JSON.stringify(filter),
|
||||
});
|
||||
return { outgoingEdgeId, logs };
|
||||
}
|
||||
|
||||
const parsedValues = parseNewCellValuesObject(variables)(
|
||||
options.cellsToUpsert,
|
||||
sheet.headerValues,
|
||||
);
|
||||
|
||||
for (const filteredRow of filteredRows) {
|
||||
const cellsRange = filteredRow.a1Range.split("!").pop();
|
||||
await sheet.loadCells(cellsRange);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user