From ebdc8ec307606f6ab5d2b38c3dc7a926432dc806 Mon Sep 17 00:00:00 2001 From: Alex Liang Date: Fri, 28 Dec 2018 12:19:07 -0500 Subject: [PATCH] fix(filter): null pointer issue when matching data with fuzzy filter --- src/Grid.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Grid.js b/src/Grid.js index 3f13f41..47b6cd1 100644 --- a/src/Grid.js +++ b/src/Grid.js @@ -130,9 +130,9 @@ const computeSortOptions = (sortOptions, { ident, display }) => { } const matchData = (rowData, fuzzyFilter) => header => - extractAndFormatData({ rowData, header }) - .toLowerCase() - .includes(fuzzyFilter.toLowerCase()) + fromNullable(extractAndFormatData({ rowData, header })) + .map(txt => txt.toLowerCase().includes(fuzzyFilter.toLowerCase())) + .getOrElse() const filterData = (data, headers, fuzzyFilter) => { const filteredHeaders = R.filter(({ isKey, isFiltered }) => isKey || isFiltered, headers)