Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
67f3384
Return file snapshot on upload (#88)
urbantumbleweed Mar 24, 2017
5edc780
feat(react-native): react-native and boilerplate support (#90)
prescottprue Mar 24, 2017
2d1bbb7
Added XMLHttpRequest to tests (to fix firebase auth issue)
Mar 24, 2017
0ffacb0
react-native complete example started.
Mar 24, 2017
224de4e
Firebase showing up in react-native example.
Mar 24, 2017
78f3ed4
Home now displays auth in a string.
Mar 25, 2017
2b2f429
react-native now working with firebase js library
prescottprue Mar 25, 2017
cc0ad58
Switched to ReactNative instead of rn
prescottprue Mar 25, 2017
d65aa2f
Version v1.4.0-beta (#97)
prescottprue Mar 26, 2017
04039a2
Version v1.4.0 Beta 2 (#100)
prescottprue Mar 28, 2017
5042759
Version v1.4.0 Beta 3 (#101)
prescottprue Mar 28, 2017
27d64e7
Merge branch 'master' into v1.4.0
prescottprue Mar 30, 2017
acd14f9
Merge branch 'master' into v1.4.0
Apr 1, 2017
c960361
Version 1.4.0 Beta 4 (#105)
prescottprue Apr 3, 2017
459c222
Version v1.4.0 Release Candidate 1 (#110)
prescottprue Apr 5, 2017
23bb32a
Form utils added to example.
prescottprue Apr 10, 2017
bc64cf5
Roadmap updated with info on nested populates and updateProfile method.
Apr 15, 2017
b3c87bd
Merge branch 'master' into v1.4.0
Apr 15, 2017
d4b86d1
Server side rendering notes added.
Apr 26, 2017
d7943f5
Merge branch 'master' into v1.4.0
May 5, 2017
36de200
Support for custom auth parameters added.
May 5, 2017
6b2826c
Merge branch 'master' into v1.4.0
May 5, 2017
e478d03
notParsed query parameter. isLoaded returns true issue (#121)
May 5, 2017
85e968e
Use prop-types package instead of the bundled prop-types (#122)
petetnt May 5, 2017
7dbe7b2
key: true lists support for profileParamsToPopulate (#123)
fej-snikduj May 5, 2017
ff11deb
Fixed typos in material-example
May 6, 2017
e89e381
Fixed the last of the "react" typos within material example.
May 6, 2017
3655517
Firebase updated to v3.9.0. More material example updates.
prescottprue May 6, 2017
4e629a9
Lint removed.
prescottprue May 6, 2017
e53dc19
More lint removal from material-ui example.
prescottprue May 6, 2017
caa9bd4
Added message to clarify home container.
prescottprue May 6, 2017
c964724
Not populated delete working in material-ui example
prescottprue May 6, 2017
c92a563
Pull request template updated. Roadmap updated with react-native-fire…
prescottprue May 16, 2017
90489f6
SSR and Auth sections added to recipes. Roadmap updated for coming v1…
prescottprue May 16, 2017
4404433
Merge branch 'master' into v1.4.0
prescottprue May 16, 2017
12df1e8
Auth Recipes cleaned up.
prescottprue May 16, 2017
b49e98f
Version v1.4.0-rc.3 (#128) (#134)
prescottprue May 16, 2017
d86b06d
Exposing Firebase messaging added to roadmap for v1.5.0.
May 16, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
SSR and Auth sections added to recipes. Roadmap updated for coming v1…
….4.0 release

* Added notes from #93 to simple example.
  • Loading branch information
prescottprue committed May 16, 2017
commit 90489f679638b0c5a63c53dfaae7c951c1bfe095
6 changes: 4 additions & 2 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
* [Storage](/docs/storage.md)
* [Recipes](/docs/recipes/README.md)
* [Profile](/docs/recipes/profile.md)
* [Upload](/docs/recipes/upload.md)
* [Auth](/docs/recipes/auth.md)
* [Actions](/docs/recipes/actions.md)
* [Thunks](/docs/recipes/thunks.md)
* [Epics](/docs/recipes/epics.md)
* [Routing](/docs/recipes/routing.md)
* [Populate](/docs/recipes/populate.md)
* [Upload](/docs/recipes/upload.md)
* [Redux Form](/docs/recipes/redux-form.md)
* [React Native](/docs/recipes/react-native.md)
* [Populate](/docs/recipes/populate.md)
* [Server Side Rendering](/docs/recipes/ssr.md)
* [API Reference](/docs/api/README.md)
* [constants](/docs/api/constants.md)
* [firebaseConnect](/docs/api/connect.md)
Expand Down
116 changes: 116 additions & 0 deletions docs/recipes/auth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Auth Recipes

## Wait For Auth To Load
One of the most common patterns with authentication, is showing a loading spinner until

```js
import React, { Component, PropTypes } from 'react'
import { isLoaded, isEmpty, pathToJS, dataToJS } from 'react-redux-firebase'
import { connect } from 'react-redux'

class App extends Component {
render() {
const { auth } = this.props

if (!isLoaded(auth) || isEmpty(auth)) {
return (<p>you need to login</p>)
}

return (
<div>
Todos For User with id: { auth.uid }
<TodoComponent
todos={this.props.todos}
/>
</div>
)
}
}

const fbWrappedComponent = firebaseConnect([
'/todos'
])(App)

export default connect(
({ firebase }) => ({
todos: dataToJS(firebase, 'todos'),
auth: pathToJS(firebase, 'auth')
})
)(fbWrappedComponent)
```

## Google Login

Here is an example of a component that shows a Google login button if the user is not logged in, and a welcome message if they are. The initial loading state is handled with a simple "loading" message

```js
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import GoogleButton from 'react-google-button'
import { connect } from 'react-redux'
import {
firebaseConnect,
isLoaded,
isEmpty,
pathToJS
} from 'react-redux-firebase'

@firebaseConnect() // add this.props.firebase
@connect( // map redux state to props
({ firebase }) => ({
authError: pathToJS(firebase, 'authError')
})
)
export default class Login extends Component {
static propTypes = {
firebase: PropTypes.shape({
login: PropTypes.func.isRequired
})
}

state = {
isLoading: false
}

googleLogin = loginData => {
this.setState({ isLoading: true })
return this.props.firebase
.login({ provider: 'google' })
.then(() => {
this.setState({ isLoading: false })
// this is where you can redirect to another route
})
.catch((error) => {
console.log('there was an error', error)
console.log('error prop:', this.props.authError) // thanks to connect
})
}

render () {
const { authError } = this.props
const { snackCanOpen } = this.state

if (!isLoaded(auth)) {
return (
<div>
<span>Loading</span>
</div>
)
}

if (isEmpty(auth)) {
return (
<div>
<span>Login page</span>
<GoogleButton onClick={this.googleLogin} />
</div>
)
}

return (
<p>Welcome!</p>
)

}
}
```
23 changes: 23 additions & 0 deletions docs/recipes/ssr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Server Side Rendering

## Implement with webpack

### Make Sure Loaders are setup appropriately
Note, make sure that you have excluded `node_modules` in your webpack loaders

```js
// webpack 1
exclude: /node_modules/,
// or webpack 2
options: { presets: [ [ 'es2015', { modules: false } ] ] }
```


### Include XMLHttpRequest

```js
// needed to fix "Error: The XMLHttpRequest compatibility library was not found."
global.XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest
```

If you find adding this extra code to be an annoyance or you would like to discuss a different way to do it, please feel free to open an issue/pull request or reach out on [gitter](https://gitter.im/redux-firebase/Lobby).
55 changes: 16 additions & 39 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,20 @@
# Roadmap

## Recent Minor Version (`v1.3.0`)

**Note:** These changes include the combination of changes from all pre-release versions (`v1.3.0-*`)

### Breaking Changes
* Get ordered data using `orderedToJS(firebase, 'path')` which returns an array
* `commonjs`, `es`, `umd` versions built with Webpack (could cause issues with some webpack configs)
* `INIT_BY_PATH` action type no longer exists (replaced with `UNSET_LISTENER`)
* Action is no longer automatically fired when removing listeners (not enabled by default as it removes data from redux)

### Features
* Webpack 2 support (fixes [#64](https://github.com/prescottprue/react-redux-firebase/issues/64))
* Helpers are available as imports from top level:
```js
import { pathToJS, dataToJS, populatedDataToJS } from 'react-redux-firebase'
```
* Multiple populates now supported (Fixes [#49](https://github.com/prescottprue/react-redux-firebase/issues/49))
* `keyProp` option added to assign key from populate to a property (described in [#40](https://github.com/prescottprue/react-redux-firebase/issues/40))
* `keyProp` usage illustrated within [material example](https://github.com/prescottprue/react-redux-firebase/tree/master/examples/complete/material) (on projects list page)
* `storeAs` capability added allowing for multiple queries on the same route (As requested in [#56](https://github.com/prescottprue/react-redux-firebase/issues/56))
* `storeAs` usage illustrated in [multiple queries example](https://github.com/prescottprue/react-redux-firebase/tree/v1.3.0-rc.1/examples/snippets/multipleQueries)
* `dispatchOnUnsetListener` config option added for enabling dispatching of `UNSET_LISTENER` action (along with matching reducer case which removes data from path) when unsetting listeners
* [material example](https://github.com/prescottprue/react-redux-firebase/tree/master/examples/complete/material) errors fixed (including [#54](https://github.com/prescottprue/react-redux-firebase/issues/54))
* Removed redundant set calls within `SET` case of reducer (unnecessary and can cause `invalid keyPath`)
* Demo now available at [demo.react-redux-firebase.com](https://demo.react-redux-firebase.com)
* Delete project button added to [material example](https://github.com/prescottprue/react-redux-firebase/tree/master/examples/complete/material)

## Upcoming Minor Version (`v1.4.0`)
## Recent Minor Version (`v1.4.0`)

#### Features
* `react-native` support (including [complete example](https://github.com/prescottprue/react-redux-firebase/tree/v1.4.0-beta/examples/complete/react-native) app as well as a [create your own recipe](/docs/recipes/react-native.md))
* Server Side Rendering Support ([#72](https://github.com/prescottprue/react-redux-firebase/issues/72))
* Support for Boilerplates ([#53](https://github.com/prescottprue/react-redux-firebase/issues/53))
* Use `prop-types` package instead of `React.PropTypes` [#122](https://github.com/prescottprue/react-redux-firebase/pull/122) - Thanks [@petetnt](https://github.com/petetnt)
* Use `prop-types` package instead of `React.PropTypes` [#122](https://github.com/prescottprue/react-redux-firebase/pull/122) - thanks [@petetnt](https://github.com/petetnt)
* `pushWithMeta`, `setWithMeta`, and `updateWithMeta` methods added - write to firebase with createdAt/updatedAt and createdBy/updatedBy
* Fix for `unWatchEvent` helper dispatch mapping (#82)
* `populatedDataToJS` triggers `isLoaded` to be true only when all data is populated (instead of once for unpopulated data) [#121](https://github.com/prescottprue/react-redux-firebase/issues/121)
* Support for `provider.setCustomParameters` on external auth providers (i.e. `provider.setCustomParameters({ prompt: 'select_account' })`)
* `notParsed` query param option added for not parsing when using `equalTo` (for searching numbers stored as strings)
* `profileParamsToPopulate` now works for `$key: true` lists (thanks @fej-snikduj)
* `profileParamsToPopulate` now works for `$key: true` lists - thanks [@fej-snikduj](https://github.com/fej-snikduj)
* `onRedirectResult` config option added (runs when redirect result occurs)


#### Enhancements/Fixes
* Improvements to Material Example
* Projects route is now protected (using `UserIsAuthenticated` HOC from `utils/router`)
Expand All @@ -53,25 +25,30 @@ import { pathToJS, dataToJS, populatedDataToJS } from 'react-redux-firebase'
* Firebase version is no longer fixed ([#109](https://github.com/prescottprue/react-redux-firebase/issues/109))
* Only used parts of Firebase Library imported (shrinks bundle size)
* `build:size` npm script added to generate size report for minified bundle ([#107](https://github.com/prescottprue/react-redux-firebase/issues/107))
* `user` and `credential` are now returned from login method (solves [#106](https://github.com/prescottprue/react-redux-firebase/issues/106))
* `user` and `credential` are now returned from login method ([#106](https://github.com/prescottprue/react-redux-firebase/issues/106))
* `yarn.lock` file added
* Compose tests improved promise handling (better use of chai-as-promised)
<!-- * Fix `profileParamsToPopulate` with `key: true` lists - thanks [@fej-snikduj](https://github.com/fej-snikduj) -->
* Fix `profileParamsToPopulate` with `key: true` lists - thanks [@fej-snikduj](https://github.com/fej-snikduj)


## Next Minor Version (`v1.5.0`)
* Setting that allows for `waitForPopulate` to be turned off (i.e. return populated data as in becomes available). As of `v1.4.0-rc.2`, populate only sets `isLoaded` to true after all children are loaded ([#121](https://github.com/prescottprue/react-redux-firebase/issues/121)), `waitForPopulate` would make this optional.
* `updateUser` method for updating currently authenticated user's user object (`/users/${uid}`)
* `updateAuth` method for updating currently authenticated user's auth object [as seen in the Firebase docs](https://firebase.google.com/docs/auth/web/manage-users#get_a_users_provider-specific_profile_information)
* Option to not remove all data on logout (potential config syntax: `preserveOnLogout: ['todos']`)
* Option for populated items updating when changed ([#69](https://github.com/prescottprue/react-redux-firebase/issues/69))

## Future Minor Versions (`v1.5.0 - v1.*.*`)
## Future Minor Versions (`v1.6.0 - v1.*.*`)

**Note:** Subject to change

#### Breaking Changes
*None Yet Planned*

#### Features
* Integration for [`react-native-google-signin`](https://github.com/devfd/react-native-google-signin) to simplify react-native authentication implementation
* Integration for [`react-native-firebase`](https://github.com/invertase/react-native-firebase) for using Firebase native modules instead of JS library
* Option for populated items updating when changed ([#69](https://github.com/prescottprue/react-redux-firebase/issues/69))
* Setting allowing for `waitForPopulate` to be turned off (i.e. return populated data as in becomes available). As of v1.4.0, populate only sets `isLoaded` to true after all children are loaded ([#121](https://github.com/prescottprue/react-redux-firebase/issues/121)), `waitForPopulate` would make this optional.
* Nested populates [#85](https://github.com/prescottprue/react-redux-firebase/issues/85)
* `updateProfile` method for updating currently authenticated user's profile
* Integration for [`react-native-google-signin`](https://github.com/devfd/react-native-google-signin) to simplify react-native authentication implementation
* Nested populates ([#85](https://github.com/prescottprue/react-redux-firebase/issues/85))

#### Enhancements/Fixes
*None Yet Planned*
Expand Down
Loading