From b34313150baa5f9d793c16be20baea80f77a7651 Mon Sep 17 00:00:00 2001 From: Scott Prue Date: Mon, 3 Feb 2020 15:06:21 -0800 Subject: [PATCH 1/3] v3.1.1 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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", From 7607c423e5d748f5c2f5c534b4d2c53395c2a8c0 Mon Sep 17 00:00:00 2001 From: Richard Scotten Date: Mon, 3 Feb 2020 15:08:07 -0800 Subject: [PATCH 2/3] feat(types): add firestore collectionGroup type - @rscotten (#855) --- index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 From 1d5e64876b7f4bd7fc7da282b08d8e5d70fbb050 Mon Sep 17 00:00:00 2001 From: Scott Prue Date: Mon, 3 Feb 2020 15:34:21 -0800 Subject: [PATCH 3/3] chore(docs): add note about useFirestoreForProfile within profile recipes - #849 --- docs/recipes/profile.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) 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