Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 3a52cb4

Browse files
authored
Fix Price Filter block if minPrice or maxPrice are null (#1278)
1 parent 6a00085 commit 3a52cb4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

assets/js/blocks/price-filter/block.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,14 @@ const PriceFilterBlock = ( { attributes, isPreview = false } ) => {
9292
}
9393

9494
const TagName = `h${ attributes.headingLevel }`;
95-
const min = Number.isFinite( minConstraint )
96-
? Math.max( minPrice, minConstraint )
97-
: minPrice;
98-
const max = Number.isFinite( maxConstraint )
99-
? Math.min( maxPrice, maxConstraint )
100-
: maxPrice;
95+
const min = Math.max(
96+
Number.isFinite( minPrice ) ? minPrice : -Infinity,
97+
Number.isFinite( minConstraint ) ? minConstraint : -Infinity
98+
);
99+
const max = Math.min(
100+
Number.isFinite( maxPrice ) ? maxPrice : Infinity,
101+
Number.isFinite( maxConstraint ) ? maxConstraint : Infinity
102+
);
101103

102104
return (
103105
<Fragment>

0 commit comments

Comments
 (0)