Skip to content

Commit 0ad5b10

Browse files
authored
Version v1.4.3 (prescottprue#171)
* `onAuthStateChange` added to config validation * deprecation warning added for `config.distpatchOnUnsetListener`
1 parent fc133ca commit 0ad5b10

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-redux-firebase",
3-
"version": "1.4.2",
3+
"version": "1.4.3",
44
"description": "Redux integration for Firebase. Comes with a Higher Order Component for use with React.",
55
"browser": "dist/react-redux-firebase.js",
66
"main": "lib/index.js",

src/utils/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ export const validateConfig = (config) => {
2929
// Check that some certain config are functions if they exist
3030
const functionProps = [
3131
'fileMetadataFactory',
32-
'profileDecorator'
32+
'profileDecorator',
33+
'onAuthStateChange'
3334
]
35+
3436
functionProps.forEach((p) => {
3537
if (!!config[p] && !isFunction(config[p])) {
3638
throw new Error(`${p} parameter in react-redux-firebase config must be a function. check your compose function.`)

src/utils/query.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { actionTypes } from '../constants'
2-
import { isNaN } from 'lodash'
2+
import { isNaN, isFunction } from 'lodash'
33

44
const { UNSET_LISTENER } = actionTypes
55

@@ -100,7 +100,11 @@ export const unsetWatcher = (firebase, dispatch, event, path, queryId = undefine
100100
delete firebase._.watchers[id]
101101
if (event !== 'first_child' && event !== 'once') {
102102
firebase.database().ref().child(path).off(event)
103-
if (firebase._.config.distpatchOnUnsetListener) {
103+
const { config } = firebase._
104+
if (config.dispatchOnUnsetListener || config.distpatchOnUnsetListener) {
105+
if (config.distpatchOnUnsetListener && isFunction(console.warn)) { // eslint-disable-line no-console
106+
console.warn('config.distpatchOnUnsetListener is Depreceated and will be removed in future versions. Please use config.dispatchOnUnsetListener (dispatch spelled correctly).') // eslint-disable-line no-console
107+
}
104108
dispatch({ type: UNSET_LISTENER, path })
105109
}
106110
}

0 commit comments

Comments
 (0)