reactfire 4.2.3 → 4.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/SuspenseSubject.d.ts +7 -1
- package/dist/auth.d.ts +4 -4
- package/dist/firebaseApp.d.ts +2 -3
- package/dist/firestore.d.ts +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2204 -2286
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +4 -122
- package/dist/index.umd.cjs.map +1 -1
- package/dist/performance.d.ts +1 -1
- package/dist/sdk.d.ts +11 -11
- package/dist/storage.d.ts +3 -4
- package/dist/useObservable.d.ts +19 -3
- package/package.json +36 -35
- package/src/SuspenseSubject.ts +48 -3
- package/src/auth.tsx +22 -5
- package/src/firebaseApp.tsx +4 -2
- package/src/firestore.tsx +9 -9
- package/src/performance.tsx +7 -6
- package/src/sdk.tsx +1 -1
- package/src/storage.tsx +5 -5
- package/src/useObservable.ts +76 -58
package/README.md
CHANGED
|
@@ -11,6 +11,10 @@ Firebase.
|
|
|
11
11
|
- **Access Firebase libraries from any component** - Need the Firestore SDK? `useFirestore`. Remote Config? `useRemoteConfig`.
|
|
12
12
|
- **Safely configure Firebase libraries** - Libraries like Firestore and Remote Config require settings like `enablePersistence` to be set before any data fetches are made. This can be tough to support in React's world of re-renders. ReactFire gives you `useInitFirestore` and `useInitRemoteConfig` hooks that guarantee they're set before anything else.
|
|
13
13
|
|
|
14
|
+
## Platform support
|
|
15
|
+
|
|
16
|
+
ReactFire is designed for **web React apps** and wraps the [Firebase Web SDK](https://firebase.google.com/docs/web/setup). It is not compatible with React Native or Expo. For React Native projects, use [react-native-firebase](https://rnfirebase.io/) instead.
|
|
17
|
+
|
|
14
18
|
## Install
|
|
15
19
|
|
|
16
20
|
```bash
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Observable, Subject, Subscriber, Subscription } from 'rxjs';
|
|
2
|
+
import { ObservableStatus } from './useObservable';
|
|
2
3
|
export declare class SuspenseSubject<T> extends Subject<T> {
|
|
3
4
|
private _timeoutWindow;
|
|
5
|
+
private _suspenseEnabled;
|
|
4
6
|
private _value;
|
|
5
7
|
private _hasValue;
|
|
6
8
|
private _timeoutHandler;
|
|
@@ -8,14 +10,18 @@ export declare class SuspenseSubject<T> extends Subject<T> {
|
|
|
8
10
|
private _error;
|
|
9
11
|
private _innerObservable;
|
|
10
12
|
private _warmupSubscription;
|
|
13
|
+
private _immutableStatus;
|
|
14
|
+
private _isComplete;
|
|
11
15
|
private _innerSubscriber;
|
|
12
16
|
private _resolveFirstEmission;
|
|
13
|
-
constructor(innerObservable: Observable<T>, _timeoutWindow: number);
|
|
17
|
+
constructor(innerObservable: Observable<T>, _timeoutWindow: number, _suspenseEnabled: boolean);
|
|
14
18
|
get hasValue(): boolean;
|
|
15
19
|
get value(): T;
|
|
16
20
|
get firstEmission(): Promise<void>;
|
|
21
|
+
private _updateImmutableStatus;
|
|
17
22
|
private _next;
|
|
18
23
|
private _reset;
|
|
19
24
|
_subscribe(subscriber: Subscriber<T>): Subscription;
|
|
20
25
|
get ourError(): any;
|
|
26
|
+
get immutableStatus(): ObservableStatus<T>;
|
|
21
27
|
}
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ReactFireOptions, ObservableStatus } from './';
|
|
3
3
|
import type { Auth, User, IdTokenResult } from 'firebase/auth';
|
|
4
|
-
|
|
4
|
+
type Claims = IdTokenResult['claims'];
|
|
5
5
|
export declare function preloadUser(authResolver: () => Promise<Auth>): Promise<User | null | undefined>;
|
|
6
6
|
/**
|
|
7
7
|
* Subscribe to Firebase auth state changes, including token refresh
|
|
@@ -26,7 +26,7 @@ export interface ClaimsCheckProps {
|
|
|
26
26
|
export interface ClaimCheckErrors {
|
|
27
27
|
[key: string]: any[];
|
|
28
28
|
}
|
|
29
|
-
export
|
|
29
|
+
export type SigninCheckResult = {
|
|
30
30
|
signedIn: false;
|
|
31
31
|
hasRequiredClaims: false;
|
|
32
32
|
errors: {};
|
|
@@ -92,7 +92,7 @@ export declare function useSigninCheck(options?: SignInCheckOptionsBasic | SignI
|
|
|
92
92
|
*
|
|
93
93
|
* Meant for Concurrent mode only (`<FirebaseAppProvider suspense=true />`). [More detail](https://github.com/FirebaseExtended/reactfire/issues/325#issuecomment-827654376).
|
|
94
94
|
*/
|
|
95
|
-
export declare function ClaimsCheck({ user, fallback, children, requiredClaims }: ClaimsCheckProps): JSX.Element;
|
|
95
|
+
export declare function ClaimsCheck({ user, fallback, children, requiredClaims }: ClaimsCheckProps): React.JSX.Element;
|
|
96
96
|
/**
|
|
97
97
|
* @deprecated Use `useSigninCheck` instead
|
|
98
98
|
*
|
|
@@ -100,5 +100,5 @@ export declare function ClaimsCheck({ user, fallback, children, requiredClaims }
|
|
|
100
100
|
*
|
|
101
101
|
* Meant for Concurrent mode only (`<FirebaseAppProvider suspense=true />`). [More detail](https://github.com/FirebaseExtended/reactfire/issues/325#issuecomment-827654376).
|
|
102
102
|
*/
|
|
103
|
-
export declare function AuthCheck({ fallback, children, requiredClaims }: AuthCheckProps):
|
|
103
|
+
export declare function AuthCheck({ fallback, children, requiredClaims }: AuthCheckProps): React.ReactElement;
|
|
104
104
|
export {};
|
package/dist/firebaseApp.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { FirebaseApp, FirebaseOptions } from 'firebase/app';
|
|
3
|
-
interface FirebaseAppProviderProps {
|
|
3
|
+
export interface FirebaseAppProviderProps {
|
|
4
4
|
firebaseApp?: FirebaseApp;
|
|
5
5
|
firebaseConfig?: FirebaseOptions;
|
|
6
6
|
appName?: string;
|
|
7
7
|
suspense?: boolean;
|
|
8
8
|
}
|
|
9
9
|
export declare const version: string;
|
|
10
|
-
export declare function FirebaseAppProvider(props: React.PropsWithChildren<FirebaseAppProviderProps>): JSX.Element;
|
|
10
|
+
export declare function FirebaseAppProvider(props: React.PropsWithChildren<FirebaseAppProviderProps>): React.JSX.Element;
|
|
11
11
|
export declare function useIsSuspenseEnabled(): boolean;
|
|
12
12
|
export declare function useSuspenseEnabledFromConfigAndContext(suspenseFromConfig?: boolean): boolean;
|
|
13
13
|
export declare function useFirebaseApp(): FirebaseApp;
|
|
14
|
-
export {};
|
package/dist/firestore.d.ts
CHANGED
|
@@ -6,9 +6,9 @@ import { Query as FirestoreQuery, QuerySnapshot, DocumentReference, DocumentData
|
|
|
6
6
|
*
|
|
7
7
|
* Use this to warm up `useFirestoreDoc` for a specific document
|
|
8
8
|
*/
|
|
9
|
-
export declare function preloadFirestoreDoc(refProvider: () => Promise<DocumentReference>): Promise<import("./SuspenseSubject").SuspenseSubject<DocumentSnapshot<DocumentData>>>;
|
|
9
|
+
export declare function preloadFirestoreDoc(refProvider: () => Promise<DocumentReference>): Promise<import("./SuspenseSubject").SuspenseSubject<DocumentSnapshot<DocumentData, DocumentData>>>;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Subscribe to Firestore Document changes
|
|
12
12
|
*
|
|
13
13
|
* You can preload data for this hook by calling `preloadFirestoreDoc`
|
|
14
14
|
*/
|
|
@@ -18,13 +18,13 @@ export declare function useFirestoreDoc<T = DocumentData>(ref: DocumentReference
|
|
|
18
18
|
*/
|
|
19
19
|
export declare function useFirestoreDocOnce<T = DocumentData>(ref: DocumentReference<T>, options?: ReactFireOptions<T>): ObservableStatus<DocumentSnapshot<T>>;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Subscribe to Firestore Document changes and unwrap the document into a plain object
|
|
22
22
|
*/
|
|
23
|
-
export declare function useFirestoreDocData<T = unknown>(ref: DocumentReference<T>, options?: ReactFireOptions<T>): ObservableStatus<T>;
|
|
23
|
+
export declare function useFirestoreDocData<T = unknown>(ref: DocumentReference<T>, options?: ReactFireOptions<T>): ObservableStatus<T | undefined>;
|
|
24
24
|
/**
|
|
25
25
|
* Get a Firestore document, unwrap the document into a plain object, and don't subscribe to changes
|
|
26
26
|
*/
|
|
27
|
-
export declare function useFirestoreDocDataOnce<T = unknown>(ref: DocumentReference<T>, options?: ReactFireOptions<T>): ObservableStatus<T>;
|
|
27
|
+
export declare function useFirestoreDocDataOnce<T = unknown>(ref: DocumentReference<T>, options?: ReactFireOptions<T>): ObservableStatus<T | undefined>;
|
|
28
28
|
/**
|
|
29
29
|
* Subscribe to a Firestore collection
|
|
30
30
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SuspenseSubject } from './SuspenseSubject';
|
|
2
2
|
import type { Query as FirestoreQuery } from 'firebase/firestore';
|
|
3
3
|
import type { Query as DatabaseQuery } from 'firebase/database';
|
|
4
|
-
export
|
|
4
|
+
export type ReactFireGlobals = {
|
|
5
5
|
_reactFireDatabaseCachedQueries: Array<DatabaseQuery>;
|
|
6
6
|
_reactFireFirestoreQueryCache: Array<FirestoreQuery>;
|
|
7
7
|
_reactFirePreloadedObservables: Map<string, SuspenseSubject<any>>;
|