Skip to content

Commit ed6b902

Browse files
authored
v1.5.0 (#270)
🍾 🥂 The long awaited v1.5.0 release 🥂 🍾 ### Breaking Changes * `browser` field has been removed from `package.json` which means commonJS build is used instead of `UMD` build from Webpack (much smaller) * [firebaseConnect] Uses `prop-types` instead of importing from React - #122 ### Core * [firebaseConnect] Allow usage of different stores in `firebaseConnect` - #148, #29 * [firebaseConnect] statics are now hoisted thanks to `hoist-non-react-statics` * [firebaseConnect] exposed `createFirebaseConnect` for creating `firebaseConnect` HOCs connected to different stores * [auth] `login` method supports `credential` parameter (with matching docs and tests updates) * [auth] deprecation warning added for `token` and `provider` combo in `login` method * [auth] Adds `updateProfile`, `updateAuth`, and `updateEmail` methods that dispatch associated start/success/failure actions * [helpers] `deleteFile` method response no longer includes `dbPath` if it is undefined (test added to check this case) * [helpers] No more race condition with `uniqueSet` - #207 * [typescript] Typescript typings - #142, #214 * [query] `watchEvent` accepts options object as third argument * [populate] Lodash path syntax support - #132 * [populate] accept a function for populate for item based populate config - #132 * [populate] Profile population (`profileParamsToPopulate`) supports single item and list population - #203 * [storage] `uploadFile` and `uploadFiles` no longer track progress by default (`storageRef.put` called directly) * [config] Usage of `profileFactory` is wrapped in try/catch to handle and reject errors within provided factory function * [config] `distpatchOnUnsetListener` spelling fixed to be `dispatchOnUnsetListener` (depreciation warning added along with a test confirm it is displayed) * [config] `enableEmptyAuthChanges` config option added - #137 ### Build * Firebase is now an external in Webpack config (shrinks UMD build size) * `.npmignore` expanded to include more files that do not needed to be included in published version (including `.babelrc` which can cause build errors) * `.babelrc` settings are now environment specific (decorators only used in testing) * `babel-preset-stage-1` removed (unnecessary) * `.eslintrc` added to tests folder which contains globals that are only necessary for testing (simplifies top level eslint config) * `.eslintrc` file now using yaml format instead of JSON format (easier to read) * `async/await` added to unit tests * Webpack 2 * [`firebase-server`](https://github.com/urish/firebase-server) used in tests instead of connecting to a real Firebase instance ### Docs * Query docs updated with `storeAs` and `keyProp` query options * `redux-persist` recipe added
1 parent bda4ed5 commit ed6b902

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+20519
-2144
lines changed

.babelrc

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
{
2-
"presets": ["es2015", "stage-1", "react"],
2+
"presets": ["es2015", "react"],
33
"plugins": [
4-
"es6-promise",
5-
"add-module-exports",
64
"lodash",
5+
"add-module-exports",
76
"transform-object-rest-spread",
87
"transform-object-assign",
9-
"transform-class-properties",
10-
"transform-decorators-legacy"
11-
]
8+
"transform-class-properties"
9+
],
10+
"env": {
11+
"es": {
12+
"comments": false
13+
},
14+
"commonjs": {
15+
"comments": false
16+
},
17+
"test": {
18+
"plugins": [
19+
"transform-runtime",
20+
"transform-decorators-legacy",
21+
"transform-async-to-generator"
22+
]
23+
}
24+
}
1225
}

.eslintrc

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
1-
{
2-
"parser" : "babel-eslint",
3-
"extends" : [
4-
"standard",
5-
"standard-react"
6-
],
7-
"plugins": [
8-
"babel"
9-
],
10-
"env" : {
11-
"browser" : true
12-
},
13-
"globals" : {
14-
"__DEV__" : false,
15-
"__PROD__" : false,
16-
"__DEBUG__" : false,
17-
"__COVERAGE__" : false,
18-
"__BASENAME__" : false
19-
},
20-
"rules": {
21-
"semi" : [2, "never"],
22-
"no-console": "error"
23-
}
24-
}
1+
root: true
2+
3+
parser: babel-eslint
4+
5+
extends: [standard, standard-react]
6+
plugins: [babel, react]
7+
8+
env:
9+
browser: true
10+
es6: true
11+
jasmine: true
12+
node: true
13+
14+
ecmaFeatures:
15+
jsx: true
16+
modules: true
17+
18+
rules:
19+
semi: [2, 'never']
20+
no-console: 'error'

.npmignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
docs
2+
bin
3+
examples
4+
tests
5+
coverage
6+
.istanbul.yml
7+
_book
8+
.babelrc
9+
SUMMARY.md
10+
webpack.config.js
11+
.eslintignore
12+
.eslintrc
13+
book.json
14+
CNAME
15+
.github
16+
yarn.lock
17+
.travis.yml
18+
CODE_OF_CONDUCT.md
19+
CHANGELOG.md
20+
.codeclimate.yml
21+
PATRONS.md

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ Join us on the [redux-firebase gitter](https://gitter.im/redux-firebase/Lobby).
253253
View docs for recipes on integrations with:
254254

255255
* [redux-thunk](/docs/recipes/thunks.md)
256-
* [redux-observable](/docs/recipes/redux-observable.md)
256+
* [redux-observable](/docs/recipes/epics.md)
257257
* [redux-saga](/docs/recipes/redux-saga.md)
258258
* [redux-form](/docs/recipes/redux-form.md)
259259
* [redux-auth-wrapper](/docs/recipes/routing.md#advanced)
@@ -292,7 +292,7 @@ The [examples folder](/examples) contains full applications that can be copied/a
292292
I have been talking to the author of [redux-react-firebase](https://github.com/tiberiuc/redux-react-firebase) about combining, but we are not sure that the users of both want that at this point. Join us on the [redux-firebase gitter](https://gitter.im/redux-firebase/Lobby) if you haven't already since a ton of this type of discussion goes on there.
293293

294294
#### What about [redux-firebase](https://github.com/colbyr/redux-firebase)?
295-
The author of [redux-firebase](https://github.com/colbyr/redux-firebase) has agreed to share the npm namespace! Currently the plan is to take the framework agnostic redux core logic of `react-redux-firebase` and place it into `redux-firebase`. Eventually `react-redux-firebase` and potentially other framework libraries can depend on that core (the new `redux-firebase`).
295+
The author of [redux-firebase](https://github.com/colbyr/redux-firebase) has agreed to share the npm namespace! Currently the plan is to take the framework agnostic redux core logic of `react-redux-firebase` and [place it into `redux-firebase`](https://github.com/prescottprue/redux-firebase)). Eventually `react-redux-firebase` and potentially other framework libraries can depend on that core (the new `redux-firebase`).
296296

297297
2. Why use redux if I have Firebase to store state?
298298

SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* [Upload](/docs/recipes/upload.md)
1818
* [Redux Thunk](/docs/recipes/thunks.md)
1919
* [Redux Form](/docs/recipes/redux-form.md)
20+
* [Redux Persist](/docs/recipes/redux-persist.md)
2021
* [Redux Saga](/docs/recipes/redux-saga.md)
2122
* [React Native](/docs/recipes/react-native.md)
2223
* [React Chrome Redux](/docs/recipes/react-chrome-redux.md)

bin/api-docs-generate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const exec = require('child_process').exec
22
const files = [
33
{
4-
src: 'connect.js',
4+
src: 'firebaseConnect.js',
55
dest: 'connect.md'
66
},
77
{

docs/api/compose.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ Middleware that handles configuration (placed in redux's
3636
auth redirect handling listener. (default: `true`)
3737
- `config.onAuthStateChanged` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Function run when auth state
3838
changes. Argument Pattern: `(authData, firebase, dispatch)`
39+
- `config.enableEmptyAuthChanges` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not to enable
40+
empty auth changes. When set to true, `onAuthStateChanged` will be fired with,
41+
empty auth changes such as undefined on initialization. See
42+
[#137](https://github.com/prescottprue/react-redux-firebase/issues/137) for
43+
more details. (default: `false`)
3944
- `config.onRedirectResult` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Function run when redirect
4045
result is returned. Argument Pattern: `(authData, firebase, dispatch)`
4146
- `config.customAuthParameters` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object for setting which

docs/api/connect.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ to provided firebase paths using React's Lifecycle hooks.
1313

1414
**Parameters**
1515

16-
- `dataOrFn` (optional, default `[]`)
16+
- `storeKey` (optional, default `'store'`)
1717
- `watchArray` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** Array of objects or strings for paths to sync from Firebase. Can also be a function that returns the array. The function is passed the current props and the firebase object.
1818

1919
**Examples**
@@ -52,15 +52,30 @@ import { connect } from 'react-redux'
5252
import { firebaseConnect, dataToJS } from 'react-redux-firebase'
5353

5454
// sync /todos from firebase into redux
55-
const fbWrapped = firebaseConnect((props, firebase) => ([
56-
`todos/${firebase.database().currentUser.uid}/${props.type}`
55+
const fbWrapped = firebaseConnect((props) => ([
56+
`todos/${props.type}`
5757
])(App)
5858

5959
// pass todos list for the specified type of todos from redux as `this.props.todosList`
6060
export default connect(({ firebase, type }) => ({
61-
todosList: dataToJS(firebase, `data/todos/${firebase.getIn(['auth', 'uid'])}/${type}`),
62-
profile: pathToJS(firebase, 'profile'), // pass profile data as this.props.profile
63-
auth: pathToJS(firebase, 'auth') // pass auth data as this.props.auth
61+
todosList: dataToJS(firebase, `data/todos/${type}`),
62+
}))(fbWrapped)
63+
```
64+
65+
_Data that depends on auth state_
66+
67+
```javascript
68+
import { connect } from 'react-redux'
69+
import { firebaseConnect, dataToJS } from 'react-redux-firebase'
70+
71+
// sync /todos from firebase into redux
72+
const fbWrapped = firebaseConnect((props, firebase) => ([
73+
`todos/${firebase._.authUid}`
74+
])(App)
75+
76+
// pass todos list for the specified type of todos from redux as `this.props.todosList`
77+
export default connect(({ firebase }) => ({
78+
todosList: dataToJS(firebase, `data/todos/${firebase.getIn(['auth', 'uid'])}`),
6479
}))(fbWrapped)
6580
```
6681

docs/api/constants.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ Object containing all action types
4444
- `FILE_DELETE_START` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** `@@reactReduxFirebase/FILE_DELETE_START`
4545
- `FILE_DELETE_ERROR` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** `@@reactReduxFirebase/FILE_DELETE_ERROR`
4646
- `FILE_DELETE_COMPLETE` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** `@@reactReduxFirebase/FILE_DELETE_COMPLETE`
47+
- `AUTH_UPDATE_START` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** `@@reactReduxFirebase/AUTH_UPDATE_START`
48+
- `AUTH_UPDATE_ERROR` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** `@@reactReduxFirebase/AUTH_UPDATE_ERROR`
49+
- `AUTH_UPDATE_COMPLETE` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** `@@reactReduxFirebase/AUTH_UPDATE_COMPLETE`
50+
- `PROFILE_UPDATE_START` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** `@@reactReduxFirebase/PROFILE_UPDATE_START`
51+
- `PROFILE_UPDATE_ERROR` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** `@@reactReduxFirebase/PROFILE_UPDATE_ERROR`
52+
- `PROFILE_UPDATE_COMPLETE` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** `@@reactReduxFirebase/PROFILE_UPDATE_COMPLETE`
53+
- `EMAIL_UPDATE_START` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** `@@reactReduxFirebase/EMAIL_UPDATE_START`
54+
- `EMAIL_UPDATE_ERROR` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** `@@reactReduxFirebase/EMAIL_UPDATE_ERROR`
55+
- `EMAIL_UPDATE_COMPLETE` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** `@@reactReduxFirebase/EMAIL_UPDATE_COMPLETE`
4756

4857
**Examples**
4958

@@ -69,6 +78,11 @@ Default configuration options
6978
- `enableRedirectHandling` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** `true` Whether or not to enable
7079
redirect handling. This must be disabled if environment is not http/https
7180
such as with react-native.
81+
- `enableEmptyAuthChanges` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** `false` Whether or not to enable
82+
empty auth changes. When set to true, `onAuthStateChanged` will be fired with,
83+
empty auth changes such as `undefined` on initialization
84+
(see [#137](https://github.com/prescottprue/react-redux-firebase/issues/137)).
85+
Requires `v1.5.0-alpha` or higher.
7286
- `autoPopulateProfile` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** `true` Whether or not to
7387
automatically populate profile with data loaded through
7488
profileParamsToPopulate config.
@@ -77,7 +91,7 @@ Default configuration options
7791
the data path. For example role parameter on profile populated from 'roles'
7892
root. True will call SET_PROFILE as well as a SET action with the role that
7993
is loaded (places it in data/roles).
80-
- `distpatchOnUnsetListener` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** `false` Whether or not to
94+
- `dispatchOnUnsetListener` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** `false` Whether or not to
8195
dispatch UNSET_LISTENER when disabling listeners for a specific path. USE WITH CAUTION
8296
Setting this to true allows an action to be called that removes data
8397
from redux (which might not always be expected).

docs/api/helpers.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ Detect whether items are loaded yet or not
2222
**Examples**
2323

2424
```javascript
25-
import React, { Component, PropTypes } from 'react'
25+
import React, { Component } from 'react'
26+
import PropTypes from 'prop-types'
2627
import { connect } from 'react-redux'
2728
import { firebaseConnect, isLoaded, dataToJS } from 'react-redux-firebase'
2829
```
@@ -41,7 +42,8 @@ Detect whether items are empty or not
4142
**Examples**
4243

4344
```javascript
44-
import React, { Component, PropTypes } from 'react'
45+
import React, { Component } from 'react'
46+
import PropTypes from 'prop-types'
4547
import { connect } from 'react-redux'
4648
import { firebaseConnect, isEmpty, dataToJS } from 'react-redux-firebase'
4749
```

0 commit comments

Comments
 (0)