Skip to content

Commit 1a84f72

Browse files
pgiguere1montymxb
authored andcommitted
Fix filtering with a 1-digit number (#831) (#832)
1 parent f5fc281 commit 1a84f72

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### NEXT RELEASE
44

55
* _Contributing to this repo? Add info about your change here to be included in next release_
6+
* Fix: Filtering with a 1-digit number (#831), thanks to [Pascal Giguère](https://github.com/pgiguere1)
67

78
### 1.1.2
89

src/components/BrowserFilter/FilterRow.react.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,10 @@ function compareValue(info, value, onChangeCompareTo, active) {
5555
value={value}
5656
onChange={(e) => {
5757
let val = value;
58-
if (!e.target.value.length) {
59-
val = '';
60-
} else if (e.target.value.length === 1) {
61-
val = validateNumeric(e.target.value) ? e.target.value : value;
62-
} else {
63-
val = validateNumeric(e.target.value) ? parseFloat(e.target.value) : value;
58+
if (!e.target.value.length || e.target.value === '-') {
59+
val = e.target.value;
60+
} else if (validateNumeric(e.target.value)) {
61+
val = parseFloat(e.target.value);
6462
}
6563
onChangeCompareTo(val);
6664
}} />

0 commit comments

Comments
 (0)