2
0

🐛 (sheets) Fix sheet block when filter is undefined

This commit is contained in:
Baptiste Arnaud
2023-06-29 15:17:51 +02:00
parent 50fcbfd95e
commit 9658277d97
2 changed files with 3 additions and 2 deletions

View File

@ -44,7 +44,7 @@ export const getRow = async (
rows.filter((row) => rows.filter((row) =>
referenceCell referenceCell
? row[referenceCell.column as string] === referenceCell.value ? row[referenceCell.column as string] === referenceCell.value
: matchFilter(row, filter as NonNullable<typeof filter>) : matchFilter(row, filter)
) )
) )
if (filteredRows.length === 0) { if (filteredRows.length === 0) {

View File

@ -8,8 +8,9 @@ import { GoogleSpreadsheetRow } from 'google-spreadsheet'
export const matchFilter = ( export const matchFilter = (
row: GoogleSpreadsheetRow, row: GoogleSpreadsheetRow,
filter: NonNullable<GoogleSheetsGetOptions['filter']> filter: GoogleSheetsGetOptions['filter']
) => { ) => {
if (!filter) return true
return filter.logicalOperator === LogicalOperator.AND return filter.logicalOperator === LogicalOperator.AND
? filter.comparisons.every( ? filter.comparisons.every(
(comparison) => (comparison) =>