-
-
Notifications
You must be signed in to change notification settings - Fork 555
Fix applyParamsToQuery: make equalTo, startAt and endAt parse numbers… #94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… correctly if needed.
Codecov Report
@@ Coverage Diff @@
## master #94 +/- ##
==========================================
- Coverage 88.77% 88.75% -0.02%
==========================================
Files 17 17
Lines 1354 1361 +7
Branches 224 225 +1
==========================================
+ Hits 1202 1208 +6
- Misses 152 153 +1 Continue to review full report at Codecov.
|
@@ -2,6 +2,14 @@ import { actionTypes } from '../constants' | |||
|
|||
const { UNSET_LISTENER } = actionTypes | |||
|
|||
const tryParseToNumber = (value) => { | |||
const result = Number(value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't ever throw does it? even if value is undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to MDN:
If the argument cannot be converted into a number, it returns NaN.
And effectively, i've just tested in Chrome, Firefox and Node and Number(undefined)
returns NaN
. So, tryParseToNumber
would return the undefined itself.
Great fix! Planning on releasing this in a patch sometime today (hopefully after adding to the tests to cover this). Will post here on release even though issue will be closed. |
* Includes #94 - Fix query params containing numbers * Includes recent docs updates
### Enhancements * #92, #94 - Issue with query params containing numbers (thanks @biomorgoth) * #82, #83 - dispatch parameter fixed in `unWatchEvent` * #89 - Separate sections added to docs for [`props.firebase`](http://react-redux-firebase.com/docs/api/props-firebase.html) and [`getFirebase`](http://react-redux-firebase.com/docs/api/get-firebase.html)
… correctly if needed.
Solves issue #92