diff --git a/docs/recipes/profile.md b/docs/recipes/profile.md index 70b9d4344..13d439482 100644 --- a/docs/recipes/profile.md +++ b/docs/recipes/profile.md @@ -6,7 +6,7 @@ Profile object is used to store data associated with a user. Using profile is in It is common to store the list of user profiles under a collection called "users" or "profiles". For this example we will use "users". -Include the `userProfile` parameter in config when setting up store enhancer: +Include the `userProfile` parameter in config passed to react-redux-firebase: ```js const config = { @@ -14,7 +14,9 @@ const config = { } ``` -### Using useSelector Hook +### Get Profile From State + +#### Using useSelector Hook Then later `connect` (from [react-redux](https://github.com/reactjs/react-redux/blob/master/docs/api.md)) to redux state with: @@ -32,7 +34,7 @@ function SomeComponent() { } ``` -### Using connect HOC +#### Using connect HOC Then later `connect` (from [react-redux](https://github.com/reactjs/react-redux/blob/master/docs/api.md)) to redux state with: @@ -52,6 +54,17 @@ connect( connect(({ firebase: { profile } }) => ({ profile }))(SomeComponent) ``` +## Profile in Firestore + +To use Firestore for storing profile data instead of Real Time Database, the basic example can be followed exactly with the following config. + +```js +const config = { + userProfile: 'users', // where profiles are stored in database + useFirestoreForProfile: true // use Firestore for profile instead of RTDB +} +``` + ## Update Profile The current users profile can be updated by using the `updateProfile` method: @@ -109,11 +122,14 @@ const config = { } ``` +This also works with profiles stored on Firestore if using the `useFirestoreForProfile` option + ## List Online Users To list online users and/or track sessions, view the [presence recipe](/docs/recipes/auth.md#presence) ## Populate Parameters + If profile object contains an key or a list of keys as parameters, you can populate those parameters with the matching value from another location on firebase. #### List diff --git a/index.d.ts b/index.d.ts index cb7c73ed8..3dba8a10a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -390,7 +390,12 @@ export interface ReduxFirestoreQuerySetting { * Collection name * @see https://github.com/prescottprue/redux-firestore#collection */ - collection: string + collection?: string + /** + * Collection Group name + * @see https://github.com/prescottprue/redux-firestore#collection-group + */ + collectionGroup?: string /** * Document id * @see https://github.com/prescottprue/redux-firestore#document diff --git a/package-lock.json b/package-lock.json index 81611dc56..51a99e63a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-redux-firebase", - "version": "3.1.0", + "version": "3.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index fd6999aa7..f8c37b4a6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-redux-firebase", - "version": "3.1.0", + "version": "3.1.1", "description": "Redux integration for Firebase. Comes with a Higher Order Components for use with React.", "main": "lib/index.js", "module": "es/index.js",