Skip to content

Commit e4100c9

Browse files
authored
v3.0.0-alpha.12 (prescottprue#693)
* fix(docs): remove remaining instances of getFirebase from docs - prescottprue#635 (prescottprue#694) * feat(core): Start React hook API - prescottprue#684 - @illuminist
1 parent 3c490e0 commit e4100c9

File tree

20 files changed

+110
-195
lines changed

20 files changed

+110
-195
lines changed

SUMMARY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
* [dataReducer](/docs/api/reducers.md#datareducer)
4444
* [orderedReducer](/docs/api/reducers.md#orderedreducer)
4545
* [props.firebase](/docs/api/props-firebase.md)
46-
* [getFirebase](/docs/api/get-firebase.md)
4746
* [firebaseInstance](/docs/api/firebaseInstance.md)
4847
* [helpers](/docs/api/helpers.md)
4948
* Migration Guides

docs/FAQ.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
* `react-native` support ([web/js](http://react-redux-firebase.com/docs/recipes/react-native.html) or native modules through [`react-native-firebase`](http://docs.react-redux-firebase.com/history/v2.0.0/docs/recipes/react-native.html#native-modules))
88
* tons of [integrations](#integrations)
99
* [`profileFactory`](http://react-redux-firebase.com/docs/config) - change format of profile stored on Firebase
10-
* [`getFirebase`](http://react-redux-firebase.com/docs/thunks) - access to firebase instance that fires actions when methods are called
1110
* [access to firebase's `storage`](http://react-redux-firebase.com/docs/storage) and `messaging` services
1211
* `uniqueSet` method helper for only setting if location doesn't already exist
1312
* Object or String notation for paths (`[{ path: '/todos' }]` equivalent to `['/todos']`)

docs/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
* [dataReducer](/docs/api/reducers.md#datareducer)
4545
* [orderedReducer](/docs/api/reducers.md#orderedreducer)
4646
* [props.firebase](/docs/api/props-firebase.md)
47-
* [getFirebase](/docs/api/get-firebase.md)
4847
* [firebaseInstance](/docs/api/firebaseInstance.md)
4948
* [helpers](/docs/api/helpers.md)
5049
* [FAQ](/docs/FAQ.md)

docs/api/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Just like [redux](http://redux.js.org/docs/api/index.html), the react-redux-fire
1111
* [withFirestore](/docs/api/withFirestore.md)
1212
* [reducer](/docs/api/reducer.md) (also exported as `firebaseReducer`)
1313
* [reactReduxFirebase](/docs/api/enhancer.md)
14-
* [getFirebase](/docs/api/get-firebase.md)
1514
* [constants](/docs/api/constants.md)
1615
* [actionTypes](/docs/api/constants.md)
1716
* [helpers](/docs/api/helpers.md)

docs/api/get-firebase.md

Lines changed: 0 additions & 42 deletions
This file was deleted.

docs/auth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const enhance = connect(
1616
enhance(SomeComponent)
1717
```
1818

19-
If you need access to methods that are not available at the top level, you can access Firebase's Full Auth API using `props.firebase.auth()` or `getFirebase().auth()`.
19+
If you need access to methods that are not available at the top level, you can access Firebase's Full Auth API using `props.firebase.auth()`
2020

2121
#### NOTE
2222
All examples below assume you have passed `firebase` from `context` to props. Wrapping your component with with the `withFirebase` or `firebaseConnect` Higher Order Components will make `props.firebase` available within your component:

docs/integrations/react-chrome-redux.md

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ const store = new Store({
2727
// Do not call firebaseConnect here
2828
export default connect(null, { login })(LoginForm);
2929
```
30-
Then, create your alias in the background script, import `react-redux-firebase` as well as `redux-thunk` to wait for Firebase's reply before updating the state (see reply in [ issue #84 on react-chrome-redux](https://github.com/tshaddix/react-chrome-redux/issues/84)).
30+
Then, create your alias in the background script, import `react-redux-firebase` as well as `redux-thunk` to wait for Firebase's reply before updating the state (see reply in [issue #84 on react-chrome-redux](https://github.com/tshaddix/react-chrome-redux/issues/84)).
3131

3232
```js
3333
// in event (background script)
3434
// ...
3535
import thunk from 'redux-thunk'
36-
import { reactReduxFirebase, getFirebase } from 'react-redux-firebase'
36+
import { reactReduxFirebase } from 'react-redux-firebase'
3737
// ...
3838
// Add redux Firebase to compose
3939
const createStoreWithFirebase = compose(
@@ -49,27 +49,4 @@ const store = createStoreWithFirebase(
4949
wrapStore(store, {
5050
portName: 'example'
5151
});
52-
// ...
53-
const aliases = {
54-
USER_LOGGING_IN: (payload) => {
55-
return (dispatch) => {
56-
getFirebase().login({
57-
email: payload.data.email,
58-
password: payload.data.password
59-
})
60-
.then(() => {
61-
dispatch({
62-
type: constants.USER_LOGGED_IN,
63-
payload: "ok"
64-
})
65-
})
66-
.catch(() => {
67-
dispatch({
68-
type: constants.USER_LOGGED_OUT,
69-
payload: "logout"
70-
})
71-
})
72-
}
73-
}
74-
};
7552
```

docs/integrations/react-native.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Passing in an instance also allows for libraries with similar APIs (such as [`re
2828
```js
2929
import { compose, createStore } from 'redux';
3030
import RNFirebase from 'react-native-firebase';
31-
import { getFirebase, reactReduxFirebase } from 'react-redux-firebase';
31+
import { reactReduxFirebase } from 'react-redux-firebase';
3232
import thunk from 'redux-thunk';
3333
import makeRootReducer from './reducers';
3434

docs/integrations/redux-form.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Examples below assume that you have setup `redux-observable` middleware so that
99
Debounce writing of info that is typed to a ref on Firebase (useful for syncing changes typed into redux-form inputs).
1010

1111
```javascript
12+
import firebase from 'firebase/app'
13+
import 'firebase/database'
1214
import { actionTypes } from 'redux-form';
1315
import { Observable } from 'rxjs';
1416
import 'rxjs/add/operator/switchMap';
@@ -22,10 +24,10 @@ const blur = action$ => action$.ofType(actionTypes.BLUR);
2224
// Combine form input streams
2325
const formInput = actionStreams$ => Observable.merge(...actionStreams$);
2426

25-
const firebaseSet$ = (getFirebase, path, payload) =>
26-
Observable.fromPromise(getFirebase().ref(path).set(payload));
27+
const firebaseSet$ = (path, payload) =>
28+
Observable.fromPromise(firebase.database().ref(path).set(payload));
2729

28-
export const reduxFormFieldChangeEpic = (action$, { getState, dispatch }, getFirebase) =>
30+
export const reduxFormFieldChangeEpic = (action$, { getState, dispatch }) =>
2931
// create a stream of formInput actions, listen to change and blur events
3032
formInput([change(action$), blur(action$)])
3133
.do(({ meta }) => { // create a side-effect for dispatching action before update
@@ -39,7 +41,7 @@ export const reduxFormFieldChangeEpic = (action$, { getState, dispatch }, getFir
3941
const path = 'some/path'
4042

4143
// make call to update firebase
42-
return firebaseSet$(getFirebase, path, payload)
44+
return firebaseSet$(path, payload)
4345
// map each promise to an action that indicates the update complete
4446
.mapTo(({
4547
type: 'FORM_FIELD_UPDATED',
@@ -53,6 +55,8 @@ export const reduxFormFieldChangeEpic = (action$, { getState, dispatch }, getFir
5355
Writing of info that is changed in a redux-form array to firebase.
5456

5557
```js
58+
import firebase from 'firebase/app'
59+
import 'firebase/database'
5660
import { actionTypes } from 'redux-form';
5761
import { get } from 'lodash';
5862
import { Observable } from 'rxjs';
@@ -65,12 +69,13 @@ const arrayPush = action$ => action$.ofType(actionTypes.ARRAY_PUSH);
6569
// Combine form array action streams
6670
const formArrayAction = actionStream$ => Observable.merge(...actionStream$);
6771

68-
const firebaseSet$ = (getFirebase, path, payload) =>
69-
Observable.fromPromise(getFirebase().ref(path).set(payload));
72+
export function firebaseSet$(path, payload) {
73+
return Observable.fromPromise(firebase.database().ref(path).set(payload));
74+
}
7075

71-
export const reduxFormArrayEpic = (action$, { getState }, getFirebase) =>
76+
export function reduxFormArrayEpic(action$, { getState }) {
7277
// create a stream of formArray actions, listen to add and remove events
73-
formArrayAction([arrayRemove(action$), arrayPush(action$)])
78+
return formArrayAction([arrayRemove(action$), arrayPush(action$)])
7479
// map arrayActions to an Observable which is merged in the output Observable of promises
7580
.mergeMap((action) => {
7681
const { form } = getState();
@@ -79,16 +84,12 @@ export const reduxFormArrayEpic = (action$, { getState }, getFirebase) =>
7984
const path = 'some/path'
8085

8186
// make call to update firebase
82-
return firebaseSet$(getFirebase, path, payload)
87+
return firebaseSet$(path, payload)
8388
// the action indicating the action was completed
8489
.mapTo(({
8590
type: 'FORM_ARRAY_CHANGE',
8691
payload: meta,
8792
}));
8893
});
89-
90-
export default {
91-
reduxFormFieldChangeEpic,
92-
reduxFormArrayEpic,
93-
};
94+
}
9495
```
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
# redux-observable
2-
If you are using `redux-observable`, make sure to set up your redux-observable middleware so that firebase is available within your epics. Here is an example `combineEpics` function that adds `getFirebase` as third argument along with an epic that uses it:
2+
If you are using `redux-observable`, make sure to set up your redux-observable middleware so that firebase is available within your epics. Here is an example `combineEpics` function:
33

44
## Setup
5-
Examples below assume that you have setup `redux-observable` middleware so that firebase is available within your epics. Here is an example `combineEpics` function that adds `getFirebase` as the third argument along with an epic that uses it:
5+
Examples below assume that you have setup `redux-observable` middleware so that firebase is available within your epics.
66

77
```javascript
8-
import { getFirebase } from 'react-redux-firebase'
8+
import firebase from 'firebase/app'
9+
import 'firebase/database'
910
import { combineEpics } from 'redux-observable'
1011

1112
const rootEpic = (...args) =>
12-
combineEpics(somethingEpic, epic2)(...args, getFirebase)
13+
combineEpics(somethingEpic, epic2)(...args)
1314

1415
// then later in your epics
15-
const somethingEpic = (action$, store, getFirebase) =>
16+
const somethingEpic = (action$, store) =>
1617
action$.ofType(SOMETHING)
1718
.map(() =>
18-
getFirebase().push('somePath/onFirebase', { some: 'data' })
19+
firebase.database().ref('somePath/onFirebase').push({ some: 'data' })
1920
)
2021
```
2122

@@ -31,12 +32,12 @@ Debounce is writing to a ref on Firebase such as `/notifications` (useful so tha
3132
```js
3233
const SEND_NOTIFICATION = 'SEND_NOTIFICATION';
3334

34-
export const notificationEpic = (action$, { getState, dispatch }, { getFirebase }) =>
35+
export const notificationEpic = (action$, { getState, dispatch }) =>
3536
action$.ofType(SEND_NOTIFICATION) // stream of notification actions
3637
.debounceTime(2000) // debounce SEND_NOTIFICATION actions by 2 seconds
3738
.do((action) => {
3839
// push the notification object to the notifications ref
39-
return getFirebase().push('/notifications', action.payload)
40+
return firebase.database().ref('notifications').push(action.payload)
4041
})
4142
.mapTo({ type: 'EMAIL_NOTIFICATION_CREATED' });
4243
```

0 commit comments

Comments
 (0)