From ca4028dd4b3db6d3215d4c08130d8a5bc1dceb57 Mon Sep 17 00:00:00 2001 From: Davide Silvestri <davide@baserow.io> Date: Fri, 25 Aug 2023 08:15:37 +0000 Subject: [PATCH] Resolve "Boolean filterType breaks comparing null values" --- ...27_boolean_filtertype_breaks_comparing_null_values.json | 7 +++++++ web-frontend/modules/database/viewFilters.js | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 changelog/entries/unreleased/bug/1927_boolean_filtertype_breaks_comparing_null_values.json diff --git a/changelog/entries/unreleased/bug/1927_boolean_filtertype_breaks_comparing_null_values.json b/changelog/entries/unreleased/bug/1927_boolean_filtertype_breaks_comparing_null_values.json new file mode 100644 index 000000000..6dc29c937 --- /dev/null +++ b/changelog/entries/unreleased/bug/1927_boolean_filtertype_breaks_comparing_null_values.json @@ -0,0 +1,7 @@ +{ + "type": "bug", + "message": "BooleanViewFilterType breaks comparing null values causing the frontend to crash.", + "issue_number": 1927, + "bullet_points": [], + "created_at": "2023-08-25" +} \ No newline at end of file diff --git a/web-frontend/modules/database/viewFilters.js b/web-frontend/modules/database/viewFilters.js index 8ea1e3a97..060ed0038 100644 --- a/web-frontend/modules/database/viewFilters.js +++ b/web-frontend/modules/database/viewFilters.js @@ -1566,7 +1566,12 @@ export class BooleanViewFilterType extends ViewFilterType { filterValue = trueString.includes( filterValue.toString().toLowerCase().trim() ) - rowValue = trueString.includes(rowValue.toString().toLowerCase().trim()) + + if (rowValue === null) { + rowValue = false + } else { + rowValue = trueString.includes(rowValue.toString().toLowerCase().trim()) + } return filterValue ? rowValue : !rowValue } }