Skip to content

Commit 6786fdc

Browse files
authored
v3.8.1 (#1029)
* fix(query): handle un-mounting with no listeners - #1019 * fix(types): add types for `handleRedirectResult` and re-authenticate methods - #987 * fix(types): add `populates` to query settings types - #1027 * fix(ci): remove usage of set-env from publish workflow (deprecated)
1 parent f843f94 commit 6786fdc

File tree

5 files changed

+86
-26
lines changed

5 files changed

+86
-26
lines changed

.github/workflows/publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
run: |
5555
gitBranch=${GITHUB_REF##*/}
5656
publishFlag=$(if [ "$GITHUB_REF" != 'refs/heads/master' ]; then eval echo '--tag $gitBranch'; else echo ''; fi;)
57-
echo "::set-env name=PACKAGE_VERSION::$(cat package.json | jq -r '.version')"
57+
echo "PACKAGE_VERSION=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV
5858
npm publish $publishFlag
5959
6060
- name: Upload Coverage

index.d.ts

+82-22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react'
2-
import { FirebaseNamespace } from "@firebase/app-types";
2+
import { FirebaseNamespace } from '@firebase/app-types'
33
import * as FirestoreTypes from '@firebase/firestore-types'
44
import * as DatabaseTypes from '@firebase/database-types'
55
import * as StorageTypes from '@firebase/storage-types'
@@ -189,7 +189,7 @@ interface BaseExtendedFirebaseInstance
189189
/**
190190
* Sets data to Firebase along with meta data. Currently,
191191
* this includes createdAt and createdBy. *Warning* using this function
192-
* may have unintented consequences (setting createdAt even if data already
192+
* may have unintended consequences (setting createdAt even if data already
193193
* exists)
194194
* @param path - Path to location on Firebase which to set
195195
* @param value - Value to write to Firebase
@@ -343,7 +343,7 @@ interface BaseExtendedFirebaseInstance
343343
* OptionalOverride is left here in the event that any of the optional properties below need to be extended in the future.
344344
* Example: OptionalOverride<FirebaseNamespace, 'messaging', { messaging: ExtendedMessagingInstance }>
345345
*/
346-
type OptionalOverride<T, b extends string, P> = b extends keyof T ? P : {};
346+
type OptionalOverride<T, b extends string, P> = b extends keyof T ? P : {}
347347
type OptionalPick<T, b extends string> = Pick<T, b & keyof T>
348348

349349
type ExtendedFirebaseInstance = BaseExtendedFirebaseInstance & OptionalPick<FirebaseNamespace, 'messaging' | 'performance' | 'functions' | 'analytics' | 'remoteConfig'>
@@ -360,8 +360,7 @@ export function createFirebaseInstance(
360360
firebase: any,
361361
configs: Partial<ReduxFirestoreConfig>,
362362
dispatch: Dispatch
363-
): ExtendedFirebaseInstance;
364-
363+
): ExtendedFirebaseInstance
365364

366365
export type QueryParamOption =
367366
| 'orderByKey'
@@ -389,6 +388,7 @@ export interface ReactReduxFirebaseQuerySetting {
389388
| 'child_moved'
390389
queryParams?: QueryParamOptions
391390
storeAs?: string
391+
populates?: { child: string; root: string }[]
392392
}
393393

394394
/**
@@ -443,20 +443,39 @@ export interface ReduxFirestoreQuerySetting {
443443
* @see https://github.com/prescottprue/redux-firestore#where
444444
*/
445445
where?: WhereOptions | WhereOptions[]
446-
// https://github.com/prescottprue/redux-firestore#orderby
446+
endBefore?: FirestoreTypes.DocumentSnapshot | any | any[]
447+
/**
448+
* @see https://github.com/prescottprue/redux-firestore#orderby
449+
*/
447450
orderBy?: OrderByOptions | OrderByOptions[]
448-
// https://github.com/prescottprue/redux-firestore#limit
451+
/**
452+
* @see https://github.com/prescottprue/redux-firestore#limit
453+
*/
449454
limit?: number
450-
// https://github.com/prescottprue/redux-firestore#storeas
455+
/**
456+
* @see https://github.com/prescottprue/redux-firestore#storeas
457+
*/
451458
storeAs?: string
452-
// https://github.com/prescottprue/redux-firestore#startat
459+
/**
460+
* @see https://github.com/prescottprue/redux-firestore#startat
461+
*/
453462
startAt?: FirestoreTypes.DocumentSnapshot | any | any[]
454-
// https://github.com/prescottprue/redux-firestore#startafter
463+
/**
464+
* @see https://github.com/prescottprue/redux-firestore#startafter
465+
*/
455466
startAfter?: FirestoreTypes.DocumentSnapshot | any | any[]
456-
// https://github.com/prescottprue/redux-firestore#endat
467+
/**
468+
* @see https://github.com/prescottprue/redux-firestore#endat
469+
*/
457470
endAt?: FirestoreTypes.DocumentSnapshot | any | any[]
458-
// https://github.com/prescottprue/redux-firestore#endbefore
471+
/**
472+
* @see https://github.com/prescottprue/redux-firestore#endbefore
473+
*/
459474
endBefore?: FirestoreTypes.DocumentSnapshot | any | any[]
475+
/**
476+
* @see https://github.com/prescottprue/redux-firestore#population
477+
*/
478+
populates?: { child: string; root: string }[]
460479
}
461480

462481
/**
@@ -467,7 +486,7 @@ export type ReduxFirestoreQueries =
467486
| (ReduxFirestoreQuerySetting | string)
468487

469488
/**
470-
* Function that recieves component props and returns
489+
* Function that receives component props and returns
471490
* a list of query configuration objects for redux-firestore
472491
*/
473492
export type ReduxFirestoreQueriesFunction = (
@@ -737,6 +756,29 @@ interface ExtendedAuthInstance {
737756
* @see https://react-redux-firebase.com/docs/recipes/profile.html#update-profile
738757
*/
739758
updateProfile: (profile: Partial<ProfileType>, options?: Object) => Promise<void>
759+
760+
/**
761+
* Logs user into Firebase using external.
762+
* @param authData - Auth data from Firebase's getRedirectResult
763+
* @returns Resolves with user's profile
764+
* @see https://react-redux-firebase.com/docs/recipes/auth.html
765+
*/
766+
handleRedirectResult: (authData: any) => Promise<any>
767+
768+
/**
769+
* Re-authenticate user into Firebase. For examples, visit the
770+
* [auth section of the docs](https://react-redux-firebase.com/docs/auth.html) or the
771+
* [auth recipes section](https://react-redux-firebase.com/docs/recipes/auth.html).
772+
* @param credentials - Credentials for authenticating
773+
* @param credentials.provider - External provider (google |
774+
* facebook | twitter)
775+
* @param credentials.type - Type of external authentication
776+
* (popup | redirect) (only used with provider)
777+
* @returns Resolves with user's auth data
778+
* @see https://react-redux-firebase.com/docs/auth.html#logincredentials
779+
* @see https://react-redux-firebase.com/docs/api/firebaseInstance.html#login
780+
*/
781+
reauthenticate: (credentials: any) => Promise<any>
740782
}
741783

742784
/**
@@ -1089,35 +1131,53 @@ export interface ReduxFirestoreConfig {
10891131

10901132
helpersNamespace: string | null
10911133

1092-
// https://github.com/prescottprue/redux-firestore#loglistenererror
1134+
/**
1135+
* @see https://github.com/prescottprue/redux-firestore#loglistenererror
1136+
*/
10931137
logListenerError: boolean
10941138

1095-
// https://github.com/prescottprue/redux-firestore#enhancernamespace
1139+
/**
1140+
* @see https://github.com/prescottprue/redux-firestore#enhancernamespace
1141+
*/
10961142
enhancerNamespace: string
10971143

1098-
// https://github.com/prescottprue/redux-firestore#allowmultiplelisteners
1144+
/**
1145+
* @see https://github.com/prescottprue/redux-firestore#allowmultiplelisteners
1146+
*/
10991147
allowMultipleListeners:
11001148
| ((listenerToAttach: any, currentListeners: any) => boolean)
11011149
| boolean
11021150

1103-
// https://github.com/prescottprue/redux-firestore#preserveondelete
1151+
/**
1152+
* @see https://github.com/prescottprue/redux-firestore#preserveondelete
1153+
*/
11041154
preserveOnDelete: null | object
11051155

1106-
// https://github.com/prescottprue/redux-firestore#preserveonlistenererror
1156+
/**
1157+
* @see https://github.com/prescottprue/redux-firestore#preserveonlistenererror
1158+
*/
11071159
preserveOnListenerError: null | object
11081160

1109-
// https://github.com/prescottprue/redux-firestore#onattemptcollectiondelete
1161+
/**
1162+
* @see https://github.com/prescottprue/redux-firestore#onattemptcollectiondelete
1163+
*/
11101164
onAttemptCollectionDelete:
11111165
| null
11121166
| ((queryOption: any, dispatch: any, firebase: any) => void)
11131167

1114-
// https://github.com/prescottprue/redux-firestore#mergeordered
1168+
/**
1169+
* @see https://github.com/prescottprue/redux-firestore#mergeordered
1170+
*/
11151171
mergeOrdered: boolean
11161172

1117-
// https://github.com/prescottprue/redux-firestore#mergeordereddocupdate
1173+
/**
1174+
* @see https://github.com/prescottprue/redux-firestore#mergeordereddocupdate
1175+
*/
11181176
mergeOrderedDocUpdate: boolean
11191177

1120-
// https://github.com/prescottprue/redux-firestore#mergeorderedcollectionupdates
1178+
/**
1179+
* @see https://github.com/prescottprue/redux-firestore#mergeorderedcollectionupdates
1180+
*/
11211181
mergeOrderedCollectionUpdates: boolean
11221182
}
11231183

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-redux-firebase",
3-
"version": "3.8.0",
3+
"version": "3.8.1",
44
"description": "Redux integration for Firebase. Comes with a Higher Order Components for use with React.",
55
"main": "lib/index.js",
66
"module": "es/index.js",

src/actions/query.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export function watchEvents(firebase, dispatch, events) {
218218
* @param {Array} events - List of events for which to remove watchers
219219
*/
220220
export function unWatchEvents(firebase, dispatch, events) {
221-
events.forEach((event) => unWatchEvent(firebase, dispatch, event))
221+
events?.forEach((event) => unWatchEvent(firebase, dispatch, event))
222222
}
223223

224224
/**

0 commit comments

Comments
 (0)