From 6bc7efc737b8a5c01db2d976597d33c42075097a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dro=C5=84?= Date: Thu, 7 Jul 2022 10:23:58 +0200 Subject: [PATCH] Fix filtering by boolean attribute (#2031) * Fix parsing boolean value from query * Change v to val --- src/products/views/ProductList/filters.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/products/views/ProductList/filters.ts b/src/products/views/ProductList/filters.ts index 5da49c64b..409779366 100644 --- a/src/products/views/ProductList/filters.ts +++ b/src/products/views/ProductList/filters.ts @@ -245,8 +245,7 @@ const parseFilterValue = ( const value = params.attributes[key]; const isMulti = isArray(params.attributes[key]); - const isBooleanValue = - !isMulti && ["true", "false"].includes((value as unknown) as string); + const isBooleanValue = value.every(val => val === "true" || val === "false"); const isDateValue = (isMulti ? value : [value]).some(val => moment(val, moment.HTML5_FMT.DATE, true).isValid(), );