react-query-firebase 2.13.1 → 2.13.3
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/package.json +20 -11
- package/react-native/analytics/useLogEvent.js +1 -1
- package/react-native/analytics/useLogEvent.ts +1 -1
- package/react-native/analytics/useSetAnalyticsCollectionEnabled.js +1 -1
- package/react-native/analytics/useSetAnalyticsCollectionEnabled.ts +1 -1
- package/react-native/auth/useAuthStateReady.js +1 -1
- package/react-native/auth/useAuthStateReady.ts +1 -1
- package/react-native/auth/useCreateUserWitEmailAndPasswordMutation.ts +1 -1
- package/react-native/auth/useCurrentUser.js +1 -1
- package/react-native/auth/useCurrentUser.ts +1 -1
- package/react-native/auth/useIdToken.js +2 -2
- package/react-native/auth/useIdToken.ts +2 -2
- package/react-native/auth/useLinkWithCredentialMutation.ts +1 -1
- package/react-native/auth/useReauthenticateWitCredentialMutation.ts +1 -1
- package/react-native/auth/useReauthenticateWitRedirectMutation.ts +1 -1
- package/react-native/auth/useSendEmailVerificationMutation.ts +1 -1
- package/react-native/auth/useSignInAnonymouslyMutation.ts +1 -1
- package/react-native/auth/useSignInWitEmailAndPasswordMutation.ts +1 -1
- package/react-native/auth/useSignInWitRedirectMutation.ts +1 -1
- package/react-native/auth/useSignInWithCredentialMutation.ts +1 -1
- package/react-native/auth/useSignOutMutation.ts +1 -1
- package/react-native/context/FirebaseContextProvider.js +2 -2
- package/react-native/context/FirebaseContextProvider.tsx +2 -2
- package/react-native/firestore/useCollectionReference.ts +1 -1
- package/react-native/firestore/useCountQuery.d.ts +1 -1
- package/react-native/firestore/useCountQuery.ts +1 -1
- package/react-native/firestore/useDocReference.d.ts +1 -2
- package/react-native/firestore/useDocReference.js +4 -6
- package/react-native/firestore/useDocReference.ts +5 -13
- package/react-native/firestore/useDocReferences.ts +1 -1
- package/react-native/firestore/useGetDocData.d.ts +1 -1
- package/react-native/firestore/useGetDocData.js +1 -1
- package/react-native/firestore/useGetDocData.ts +2 -2
- package/react-native/firestore/useGetRealtimeDocData.ts +1 -1
- package/react-native/firestore/useInfiniteQuery.d.ts +1 -1
- package/react-native/firestore/useInfiniteQuery.ts +1 -1
- package/react-native/firestore/useQuery.d.ts +1 -1
- package/react-native/firestore/useQuery.ts +1 -1
- package/react-native/firestore/utils/getDocData.d.ts +1 -1
- package/react-native/firestore/utils/getDocData.ts +1 -1
- package/react-native/firestore/utils/getDocSnap.d.ts +1 -1
- package/react-native/firestore/utils/getDocSnap.ts +1 -1
- package/react-native/remoteConfig/useFetchAndActivate.js +1 -1
- package/react-native/remoteConfig/useFetchAndActivate.ts +1 -1
- package/react-native/remoteConfig/useGetValue.js +1 -1
- package/react-native/remoteConfig/useGetValue.ts +1 -1
- package/web/analytics/useLogEvent.js +1 -1
- package/web/analytics/useLogEvent.ts +1 -1
- package/web/analytics/useSetAnalyticsCollectionEnabled.js +1 -1
- package/web/analytics/useSetAnalyticsCollectionEnabled.ts +1 -1
- package/web/auth/useAuthStateReady.js +3 -7
- package/web/auth/useAuthStateReady.ts +3 -8
- package/web/auth/useCreateUserWitEmailAndPasswordMutation.ts +1 -1
- package/web/auth/useCurrentUser.js +1 -1
- package/web/auth/useCurrentUser.ts +1 -1
- package/web/auth/useGetRedirectResultMutation.js +1 -1
- package/web/auth/useGetRedirectResultMutation.ts +2 -2
- package/web/auth/useIdToken.js +2 -2
- package/web/auth/useIdToken.ts +2 -2
- package/web/auth/useLinkWithCredentialMutation.ts +1 -1
- package/web/auth/useReauthenticateWitCredentialMutation.ts +1 -1
- package/web/auth/useReauthenticateWitRedirectMutation.ts +1 -1
- package/web/auth/useSendEmailVerificationMutation.ts +1 -1
- package/web/auth/useSignInAnonymouslyMutation.ts +1 -1
- package/web/auth/useSignInWitEmailAndPasswordMutation.ts +1 -1
- package/web/auth/useSignInWitRedirectMutation.ts +1 -1
- package/web/auth/useSignInWithCredentialMutation.ts +1 -1
- package/web/auth/useSignOutMutation.ts +1 -1
- package/web/context/FirebaseContextProvider.js +2 -2
- package/web/context/FirebaseContextProvider.tsx +2 -2
- package/web/firestore/useCollectionReference.ts +1 -1
- package/web/firestore/useCompositeFilter.d.ts +1 -1
- package/web/firestore/useCountQuery.d.ts +1 -1
- package/web/firestore/useCountQuery.ts +1 -1
- package/web/firestore/useDocReference.d.ts +1 -2
- package/web/firestore/useDocReference.js +4 -6
- package/web/firestore/useDocReference.ts +5 -12
- package/web/firestore/useDocReferences.d.ts +1 -1
- package/web/firestore/useDocReferences.ts +1 -1
- package/web/firestore/useFirestore.d.ts +1 -1
- package/web/firestore/useGetDocData.d.ts +1 -1
- package/web/firestore/useGetDocData.js +1 -1
- package/web/firestore/useGetDocData.ts +2 -2
- package/web/firestore/useGetRealtimeDocData.ts +1 -1
- package/web/firestore/useInfiniteQuery.d.ts +1 -1
- package/web/firestore/useInfiniteQuery.ts +1 -1
- package/web/firestore/useQuery.d.ts +1 -1
- package/web/firestore/useQuery.ts +1 -1
- package/web/firestore/useQueryConstraints.ts +1 -1
- package/web/firestore/utils/getDocData.d.ts +1 -1
- package/web/firestore/utils/getDocData.ts +1 -1
- package/web/firestore/utils/getDocSnap.d.ts +2 -2
- package/web/firestore/utils/getDocSnap.ts +1 -1
- package/web/remoteConfig/useFetchAndActivate.js +1 -1
- package/web/remoteConfig/useFetchAndActivate.ts +1 -1
- package/web/remoteConfig/useGetValue.d.ts +1 -1
- package/web/remoteConfig/useGetValue.js +1 -1
- package/web/remoteConfig/useGetValue.ts +1 -1
- package/web/remoteConfig/useRemoteConfig.d.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
1
2
|
import { useAuth } from "./useAuth";
|
|
2
|
-
import { useCallback, useEffect, useState } from "react";
|
|
3
3
|
/**
|
|
4
4
|
* A custom hook that determines if the Firebase authentication state is ready.
|
|
5
5
|
* It uses Firebase authentication to check if the auth state is ready and updates the state accordingly.
|
|
@@ -19,12 +19,8 @@ import { useCallback, useEffect, useState } from "react";
|
|
|
19
19
|
export const useAuthStateReady = () => {
|
|
20
20
|
const firebaseAuth = useAuth();
|
|
21
21
|
const [isAuthStateReady, setIsAuthStateReady] = useState(false);
|
|
22
|
-
const callback = useCallback(async () => {
|
|
23
|
-
await firebaseAuth.authStateReady();
|
|
24
|
-
setIsAuthStateReady(true);
|
|
25
|
-
}, [firebaseAuth]);
|
|
26
22
|
useEffect(() => {
|
|
27
|
-
|
|
28
|
-
}, [
|
|
23
|
+
firebaseAuth.authStateReady().then(() => setIsAuthStateReady(true));
|
|
24
|
+
}, [firebaseAuth]);
|
|
29
25
|
return isAuthStateReady;
|
|
30
26
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
1
2
|
import { useAuth } from "./useAuth";
|
|
2
|
-
import { useCallback, useEffect, useState } from "react";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* A custom hook that determines if the Firebase authentication state is ready.
|
|
@@ -22,14 +22,9 @@ export const useAuthStateReady = () => {
|
|
|
22
22
|
|
|
23
23
|
const [isAuthStateReady, setIsAuthStateReady] = useState(false);
|
|
24
24
|
|
|
25
|
-
const callback = useCallback(async () => {
|
|
26
|
-
await firebaseAuth.authStateReady();
|
|
27
|
-
setIsAuthStateReady(true);
|
|
28
|
-
}, [firebaseAuth]);
|
|
29
|
-
|
|
30
25
|
useEffect(() => {
|
|
31
|
-
|
|
32
|
-
}, [
|
|
26
|
+
firebaseAuth.authStateReady().then(() => setIsAuthStateReady(true));
|
|
27
|
+
}, [firebaseAuth]);
|
|
33
28
|
|
|
34
29
|
return isAuthStateReady;
|
|
35
30
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
2
|
import { createUserWithEmailAndPassword, UserCredential } from "firebase/auth";
|
|
3
|
-
import { useAuth } from "./useAuth";
|
|
4
3
|
import { FirebaseError } from "firebase/app";
|
|
4
|
+
import { useAuth } from "./useAuth";
|
|
5
5
|
import { CREATE_USER_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY } from "./mutation-keys";
|
|
6
6
|
|
|
7
7
|
export type UseCreateUserWitEmailAndPasswordMutationVariables = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { onAuthStateChanged } from "firebase/auth";
|
|
2
|
-
import { useAuth } from "./useAuth";
|
|
3
2
|
import { useEffect, useState } from "react";
|
|
3
|
+
import { useAuth } from "./useAuth";
|
|
4
4
|
/**
|
|
5
5
|
* Hook that provides the current authenticated user from Firebase Auth.
|
|
6
6
|
* It listens for changes in the authentication state and updates the user accordingly.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
|
+
import { getRedirectResult } from "firebase/auth";
|
|
2
3
|
import { useAuth } from "./useAuth";
|
|
3
4
|
import { GET_REDIRECT_RESULT_MUTATION_KEY } from "./mutation-keys";
|
|
4
|
-
import { getRedirectResult } from "firebase/auth";
|
|
5
5
|
/**
|
|
6
6
|
* Custom hook to retrieve redirect result after sign in with redirect.
|
|
7
7
|
* This hook utilizes the `useMutation` functionality to support creating new user credentials asynchronously.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import { useAuth } from "./useAuth";
|
|
3
|
-
import { GET_REDIRECT_RESULT_MUTATION_KEY } from "./mutation-keys";
|
|
4
2
|
import { getRedirectResult, UserCredential } from "firebase/auth";
|
|
5
3
|
import { FirebaseError } from "firebase/app";
|
|
4
|
+
import { useAuth } from "./useAuth";
|
|
5
|
+
import { GET_REDIRECT_RESULT_MUTATION_KEY } from "./mutation-keys";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Custom hook to retrieve redirect result after sign in with redirect.
|
package/web/auth/useIdToken.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from "react";
|
|
2
|
-
import { useCurrentUser } from "./useCurrentUser";
|
|
3
2
|
import { onIdTokenChanged, getIdToken } from "firebase/auth";
|
|
3
|
+
import { useCurrentUser } from "./useCurrentUser";
|
|
4
4
|
import { useAuth } from "./useAuth";
|
|
5
5
|
/**
|
|
6
6
|
* A hook to manage the ID token.
|
|
@@ -44,7 +44,7 @@ export const useIdToken = () => {
|
|
|
44
44
|
return idToken;
|
|
45
45
|
}, [currentUser]);
|
|
46
46
|
useEffect(() => {
|
|
47
|
-
callback
|
|
47
|
+
setTimeout(callback, 0);
|
|
48
48
|
}, [callback]);
|
|
49
49
|
useEffect(() => {
|
|
50
50
|
const unsubscribe = onIdTokenChanged(auth, (user) => {
|
package/web/auth/useIdToken.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from "react";
|
|
2
|
-
import { useCurrentUser } from "./useCurrentUser";
|
|
3
2
|
import { onIdTokenChanged, getIdToken } from "firebase/auth";
|
|
3
|
+
import { useCurrentUser } from "./useCurrentUser";
|
|
4
4
|
import { useAuth } from "./useAuth";
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -59,7 +59,7 @@ export const useIdToken = (): UseIdTokenResult => {
|
|
|
59
59
|
}, [currentUser]);
|
|
60
60
|
|
|
61
61
|
useEffect(() => {
|
|
62
|
-
callback
|
|
62
|
+
setTimeout(callback, 0);
|
|
63
63
|
}, [callback]);
|
|
64
64
|
|
|
65
65
|
useEffect(() => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
2
|
import { linkWithCredential, User, AuthCredential, UserCredential } from "firebase/auth";
|
|
3
3
|
|
|
4
|
-
import { LINK_WITH_CREDENTIAL_MUTATION_KEY } from "./mutation-keys";
|
|
5
4
|
import { FirebaseError } from "firebase/app";
|
|
5
|
+
import { LINK_WITH_CREDENTIAL_MUTATION_KEY } from "./mutation-keys";
|
|
6
6
|
|
|
7
7
|
export type UseLinkWitCredentialMutationVariables = {
|
|
8
8
|
user: User;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
2
|
import { reauthenticateWithCredential, User, AuthCredential, UserCredential } from "firebase/auth";
|
|
3
|
-
import { REAUTHENTICATE_WITH_CREDENTIAL_MUTATION_KEY } from "./mutation-keys";
|
|
4
3
|
import { FirebaseError } from "firebase/app";
|
|
4
|
+
import { REAUTHENTICATE_WITH_CREDENTIAL_MUTATION_KEY } from "./mutation-keys";
|
|
5
5
|
|
|
6
6
|
export type UseReauthenticateWitCredentialMutationVariables = {
|
|
7
7
|
credential: AuthCredential;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
2
|
import { reauthenticateWithRedirect, AuthProvider, PopupRedirectResolver, User } from "firebase/auth";
|
|
3
3
|
|
|
4
|
-
import { REAUTHENTICATE_WITH_REDIRECT_MUTATION_KEY } from "./mutation-keys";
|
|
5
4
|
import { FirebaseError } from "firebase/app";
|
|
5
|
+
import { REAUTHENTICATE_WITH_REDIRECT_MUTATION_KEY } from "./mutation-keys";
|
|
6
6
|
|
|
7
7
|
export type UseReauthenticateWitRedirectMutationVariables = {
|
|
8
8
|
authProvider: AuthProvider;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
2
|
import { sendEmailVerification, User } from "firebase/auth";
|
|
3
3
|
|
|
4
|
-
import { SEND_EMAIL_VERIFICATION_MUTATION_KEY } from "./mutation-keys";
|
|
5
4
|
import { FirebaseError } from "firebase/app";
|
|
5
|
+
import { SEND_EMAIL_VERIFICATION_MUTATION_KEY } from "./mutation-keys";
|
|
6
6
|
|
|
7
7
|
export type UseSendEmailVerificationMutationVariables = {
|
|
8
8
|
user: User;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
2
|
import { signInAnonymously, UserCredential } from "firebase/auth";
|
|
3
3
|
|
|
4
|
+
import { ReactNativeFirebase } from "@react-native-firebase/app";
|
|
4
5
|
import { useAuth } from "./useAuth";
|
|
5
6
|
import { SIGN_IN_ANONYMOUSLY_MUTATION_KEY } from "./mutation-keys";
|
|
6
|
-
import { ReactNativeFirebase } from "@react-native-firebase/app";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @inline
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
2
|
import { signInWithEmailAndPassword, UserCredential } from "firebase/auth";
|
|
3
3
|
|
|
4
|
+
import { FirebaseError } from "firebase/app";
|
|
4
5
|
import { useAuth } from "./useAuth";
|
|
5
6
|
import { SIGN_IN_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY } from "./mutation-keys";
|
|
6
|
-
import { FirebaseError } from "firebase/app";
|
|
7
7
|
|
|
8
8
|
export type UseSignInWitEmailAndPasswordMutationVariables = {
|
|
9
9
|
email: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
2
|
import { signInWithRedirect, AuthProvider, PopupRedirectResolver } from "firebase/auth";
|
|
3
3
|
|
|
4
|
+
import { FirebaseError } from "firebase/app";
|
|
4
5
|
import { useAuth } from "./useAuth";
|
|
5
6
|
import { SIGN_IN_WITH_REDIRECT_MUTATION_KEY } from "./mutation-keys";
|
|
6
|
-
import { FirebaseError } from "firebase/app";
|
|
7
7
|
|
|
8
8
|
export type UseSignInWitRedirectMutationVariables = {
|
|
9
9
|
authProvider: AuthProvider;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
2
|
import { AuthCredential, UserCredential, signInWithCredential } from "firebase/auth";
|
|
3
3
|
|
|
4
|
-
import { SIGN_IN_WITH_CREDENTIAL_MUTATION_KEY } from "./mutation-keys";
|
|
5
4
|
import { FirebaseError } from "firebase/app";
|
|
5
|
+
import { SIGN_IN_WITH_CREDENTIAL_MUTATION_KEY } from "./mutation-keys";
|
|
6
6
|
import { useAuth } from "./useAuth";
|
|
7
7
|
|
|
8
8
|
export type UseSignInWithCredentialMutationVariables = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
2
|
import { signOut } from "firebase/auth";
|
|
3
3
|
|
|
4
|
-
import { SIGN_OUT_MUTATION_KEY } from "./mutation-keys";
|
|
5
4
|
import { FirebaseError } from "firebase/app";
|
|
5
|
+
import { SIGN_OUT_MUTATION_KEY } from "./mutation-keys";
|
|
6
6
|
import { useAuth } from "./useAuth";
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, useMemo } from "react";
|
|
2
|
-
import { FirebaseContext } from "./FirebaseContext";
|
|
3
2
|
import { browserLocalPersistence, browserSessionPersistence, connectAuthEmulator, getAuth, setPersistence } from "firebase/auth";
|
|
4
3
|
import { getAnalytics, setAnalyticsCollectionEnabled, setConsent } from "firebase/analytics";
|
|
5
4
|
import { getRemoteConfig } from "firebase/remote-config";
|
|
6
5
|
import { connectFirestoreEmulator, initializeFirestore } from "firebase/firestore";
|
|
7
6
|
import { initializeApp } from "firebase/app";
|
|
7
|
+
import { FirebaseContext } from "./FirebaseContext";
|
|
8
8
|
/**
|
|
9
9
|
* FirebaseContextProvider component configures and provides Firebase services to its children.
|
|
10
10
|
* Initializes Firebase app and enables optional Firebase services such as Firestore, Auth, Analytics,
|
|
@@ -53,7 +53,7 @@ export const FirebaseContextProvider = ({ emulators, options, children, authEnab
|
|
|
53
53
|
return localFirestore;
|
|
54
54
|
}
|
|
55
55
|
return null;
|
|
56
|
-
}, [firestoreSettings, emulators
|
|
56
|
+
}, [firestoreSettings, emulators, firestoreEnabled, firebase]);
|
|
57
57
|
const authPersistence = useMemo(() => {
|
|
58
58
|
switch (authPersistenceType) {
|
|
59
59
|
case "NONE":
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { PropsWithChildren, useEffect, useMemo } from "react";
|
|
2
|
-
import { FirebaseContext } from "./FirebaseContext";
|
|
3
2
|
import {
|
|
4
3
|
browserLocalPersistence,
|
|
5
4
|
browserSessionPersistence,
|
|
@@ -12,6 +11,7 @@ import { ConsentSettings, getAnalytics, setAnalyticsCollectionEnabled, setConsen
|
|
|
12
11
|
import { getRemoteConfig, RemoteConfigSettings } from "firebase/remote-config";
|
|
13
12
|
import { connectFirestoreEmulator, FirestoreSettings, initializeFirestore } from "firebase/firestore";
|
|
14
13
|
import { FirebaseOptions, initializeApp } from "firebase/app";
|
|
14
|
+
import { FirebaseContext } from "./FirebaseContext";
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @inline
|
|
@@ -184,7 +184,7 @@ export const FirebaseContextProvider: React.FC<FirebaseContextProviderProps> = (
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
return null;
|
|
187
|
-
}, [firestoreSettings, emulators
|
|
187
|
+
}, [firestoreSettings, emulators, firestoreEnabled, firebase]);
|
|
188
188
|
|
|
189
189
|
const authPersistence = useMemo(() => {
|
|
190
190
|
switch (authPersistenceType) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { collection, CollectionReference, DocumentReference } from "firebase/firestore";
|
|
2
2
|
|
|
3
3
|
import { useMemo } from "react";
|
|
4
|
-
import { useFirestore } from "./useFirestore";
|
|
5
4
|
import { AppModel } from "../../types";
|
|
5
|
+
import { useFirestore } from "./useFirestore";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @inline
|
|
@@ -34,4 +34,4 @@ export type UseCompositeFilter<AppModelType extends AppModel = AppModel> = {
|
|
|
34
34
|
* };
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
|
-
export declare const useCompositeFilter: <AppModelType extends AppModel = AppModel>({ query }: UseCompositeFilter<AppModelType>) => import("firebase/firestore").QueryCompositeFilterConstraint | undefined;
|
|
37
|
+
export declare const useCompositeFilter: <AppModelType extends AppModel = AppModel>({ query }: UseCompositeFilter<AppModelType>) => import("@firebase/firestore").QueryCompositeFilterConstraint | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CollectionReference, QueryConstraint, QueryNonFilterConstraint } from "firebase/firestore";
|
|
2
2
|
import { UseQueryResult, UseQueryOptions as UseReactQueryOptions } from "@tanstack/react-query";
|
|
3
|
-
import { QueryFilterConstraint } from "./utils/buildCompositeFilter";
|
|
4
3
|
import { AppModel } from "../../types";
|
|
4
|
+
import { QueryFilterConstraint } from "./utils/buildCompositeFilter";
|
|
5
5
|
/**
|
|
6
6
|
* @inline
|
|
7
7
|
*/
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
useQuery as useReactQuery,
|
|
13
13
|
UseQueryOptions as UseReactQueryOptions
|
|
14
14
|
} from "@tanstack/react-query";
|
|
15
|
-
import { QueryFilterConstraint } from "./utils/buildCompositeFilter";
|
|
16
15
|
import { AppModel } from "../../types";
|
|
16
|
+
import { QueryFilterConstraint } from "./utils/buildCompositeFilter";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* @inline
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DocumentReference } from "firebase/firestore";
|
|
2
1
|
import { AppModel } from "../../types";
|
|
3
2
|
import { GetDocRefOptions } from "./utils/getDocRef";
|
|
4
3
|
/**
|
|
@@ -24,4 +23,4 @@ export type UseDocReferenceOptions<AppModelType extends AppModel = AppModel> = O
|
|
|
24
23
|
* };
|
|
25
24
|
* ```
|
|
26
25
|
*/
|
|
27
|
-
export declare const useDocReference: <AppModelType extends AppModel = AppModel>({ path, reference, pathSegments }: UseDocReferenceOptions<AppModelType>) => DocumentReference<AppModelType, AppModelType> | null;
|
|
26
|
+
export declare const useDocReference: <AppModelType extends AppModel = AppModel>({ path, reference, pathSegments }: UseDocReferenceOptions<AppModelType>) => import("@firebase/firestore").DocumentReference<AppModelType, AppModelType> | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMemo } from "react";
|
|
2
2
|
import { useFirestore } from "./useFirestore";
|
|
3
3
|
import { getDocRef } from "./utils/getDocRef";
|
|
4
4
|
/**
|
|
@@ -22,9 +22,7 @@ import { getDocRef } from "./utils/getDocRef";
|
|
|
22
22
|
*/
|
|
23
23
|
export const useDocReference = ({ path, reference, pathSegments }) => {
|
|
24
24
|
const db = useFirestore();
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}, [path, reference, pathSegments, db]);
|
|
29
|
-
return ref.current;
|
|
25
|
+
return useMemo(() => {
|
|
26
|
+
return getDocRef({ db, path, pathSegments, reference });
|
|
27
|
+
}, [db, path, pathSegments, reference]);
|
|
30
28
|
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { useEffect, useRef } from "react";
|
|
4
|
-
import { useFirestore } from "./useFirestore";
|
|
1
|
+
import { useMemo } from "react";
|
|
5
2
|
import { AppModel } from "../../types";
|
|
3
|
+
import { useFirestore } from "./useFirestore";
|
|
6
4
|
import { getDocRef, GetDocRefOptions } from "./utils/getDocRef";
|
|
7
5
|
|
|
8
6
|
/**
|
|
@@ -38,13 +36,8 @@ export const useDocReference = <AppModelType extends AppModel = AppModel>({
|
|
|
38
36
|
pathSegments
|
|
39
37
|
}: UseDocReferenceOptions<AppModelType>) => {
|
|
40
38
|
const db = useFirestore();
|
|
41
|
-
const ref = useRef<DocumentReference<AppModelType, AppModelType> | null>(
|
|
42
|
-
getDocRef({ db, path, pathSegments, reference })
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
ref.current = getDocRef({ db, path, pathSegments, reference });
|
|
47
|
-
}, [path, reference, pathSegments, db]);
|
|
48
39
|
|
|
49
|
-
return
|
|
40
|
+
return useMemo(() => {
|
|
41
|
+
return getDocRef({ db, path, pathSegments, reference });
|
|
42
|
+
}, [db, path, pathSegments, reference]);
|
|
50
43
|
};
|
|
@@ -25,4 +25,4 @@ export type UseDocReferencesOptions<AppModelType extends AppModel = AppModel> =
|
|
|
25
25
|
* };
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
export declare const useDocReferences: <AppModelType extends AppModel = AppModel>({ references }: UseDocReferencesOptions<AppModelType>) => (import("firebase/firestore").DocumentReference<AppModelType, AppModelType> | null)[];
|
|
28
|
+
export declare const useDocReferences: <AppModelType extends AppModel = AppModel>({ references }: UseDocReferencesOptions<AppModelType>) => (import("@firebase/firestore").DocumentReference<AppModelType, AppModelType> | null)[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { useQuery } from "@tanstack/react-query";
|
|
1
2
|
import { useFirestore } from "./useFirestore";
|
|
2
3
|
import { getDocData } from "./utils/getDocData";
|
|
3
|
-
import { useQuery } from "@tanstack/react-query";
|
|
4
4
|
/**
|
|
5
5
|
* Executes a query on a Firestore data source and returns the resulting document.
|
|
6
6
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useFirestore } from "./useFirestore";
|
|
2
|
-
import { getDocData, GetDocDataOptions } from "./utils/getDocData";
|
|
3
1
|
import { useQuery, UseQueryOptions } from "@tanstack/react-query";
|
|
4
2
|
import { AppModel } from "../../types";
|
|
3
|
+
import { useFirestore } from "./useFirestore";
|
|
4
|
+
import { getDocData, GetDocDataOptions } from "./utils/getDocData";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @inline
|
|
@@ -2,8 +2,8 @@ import { DocumentReference, onSnapshot } from "firebase/firestore";
|
|
|
2
2
|
|
|
3
3
|
import { useEffect, useMemo, useState } from "react";
|
|
4
4
|
import { FirebaseError } from "firebase/app";
|
|
5
|
-
import { useDocReference } from "./useDocReference";
|
|
6
5
|
import { AppModel } from "../../types";
|
|
6
|
+
import { useDocReference } from "./useDocReference";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @inline
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CollectionReference, QueryConstraint, QueryNonFilterConstraint } from "firebase/firestore";
|
|
2
2
|
import { UseInfiniteQueryOptions as UseReactInfiniteQueryOptions, QueryKey, UseInfiniteQueryResult, InfiniteData } from "@tanstack/react-query";
|
|
3
|
-
import { QueryFilterConstraint } from "./utils/buildCompositeFilter";
|
|
4
3
|
import { AppModel } from "../../types";
|
|
4
|
+
import { QueryFilterConstraint } from "./utils/buildCompositeFilter";
|
|
5
5
|
/**
|
|
6
6
|
* @inline
|
|
7
7
|
*/
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
UseInfiniteQueryResult,
|
|
15
15
|
InfiniteData
|
|
16
16
|
} from "@tanstack/react-query";
|
|
17
|
-
import { QueryFilterConstraint } from "./utils/buildCompositeFilter";
|
|
18
17
|
import { AppModel } from "../../types";
|
|
18
|
+
import { QueryFilterConstraint } from "./utils/buildCompositeFilter";
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* @inline
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CollectionReference, QueryConstraint, QueryNonFilterConstraint } from "firebase/firestore";
|
|
2
2
|
import { UseQueryResult, UseQueryOptions as UseReactQueryOptions } from "@tanstack/react-query";
|
|
3
|
-
import { QueryFilterConstraint } from "./utils/buildCompositeFilter";
|
|
4
3
|
import { AppModel } from "../../types";
|
|
4
|
+
import { QueryFilterConstraint } from "./utils/buildCompositeFilter";
|
|
5
5
|
/**
|
|
6
6
|
* @inline
|
|
7
7
|
*/
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
useQuery as useReactQuery,
|
|
13
13
|
UseQueryOptions as UseReactQueryOptions
|
|
14
14
|
} from "@tanstack/react-query";
|
|
15
|
-
import { QueryFilterConstraint } from "./utils/buildCompositeFilter";
|
|
16
15
|
import { AppModel } from "../../types";
|
|
16
|
+
import { QueryFilterConstraint } from "./utils/buildCompositeFilter";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* @inline
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { QueryNonFilterConstraint } from "firebase/firestore";
|
|
2
|
+
import { useMemo } from "react";
|
|
2
3
|
import { AppModel } from "../../types/AppModel";
|
|
3
4
|
import { NonFilterQueryConstraint } from "../../types/QueryConstraints";
|
|
4
|
-
import { useMemo } from "react";
|
|
5
5
|
import { buildQueryConstraint } from "./utils/buildQueryConstraint";
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GetDocRefOptions } from "./getDocRef";
|
|
2
1
|
import { AppModel } from "../../../types";
|
|
2
|
+
import { GetDocRefOptions } from "./getDocRef";
|
|
3
3
|
/**
|
|
4
4
|
* @inline
|
|
5
5
|
*/
|
|
@@ -15,4 +15,4 @@ export type GetDocSnapOptions<AppModelType extends AppModel = AppModel> = GetDoc
|
|
|
15
15
|
*
|
|
16
16
|
* @returns {Promise<DocumentSnapshot<AppModelType, AppModelType> | null>} Returns a document reference
|
|
17
17
|
*/
|
|
18
|
-
export declare const getDocSnap: <AppModelType extends AppModel = AppModel>({ db, reference, path, pathSegments }: GetDocSnapOptions<AppModelType>) => Promise<import("firebase/firestore").DocumentSnapshot<AppModelType, AppModelType> | null>;
|
|
18
|
+
export declare const getDocSnap: <AppModelType extends AppModel = AppModel>({ db, reference, path, pathSegments }: GetDocSnapOptions<AppModelType>) => Promise<import("@firebase/firestore").DocumentSnapshot<AppModelType, AppModelType> | null>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useRemoteConfig } from "./useRemoteConfig";
|
|
2
1
|
import { ensureInitialized, fetchAndActivate } from "firebase/remote-config";
|
|
3
2
|
import { useCallback, useMemo, useState } from "react";
|
|
3
|
+
import { useRemoteConfig } from "./useRemoteConfig";
|
|
4
4
|
/**
|
|
5
5
|
* Custom hook to fetch and activate remote configuration settings.
|
|
6
6
|
* Initializes remote configuration, fetches, activates it, and tracks the fetch status.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useRemoteConfig } from "./useRemoteConfig";
|
|
2
1
|
import { ensureInitialized, fetchAndActivate } from "firebase/remote-config";
|
|
3
2
|
import { useCallback, useMemo, useState } from "react";
|
|
3
|
+
import { useRemoteConfig } from "./useRemoteConfig";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Custom hook to fetch and activate remote configuration settings.
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @param {string} key - The key for which the corresponding value is to be fetched from the remote configuration.
|
|
5
5
|
* @returns {any | null} The value associated with the specified key if available, otherwise null.
|
|
6
6
|
*/
|
|
7
|
-
export declare const useGetValue: (key: string) => import("firebase/remote-config").Value | null;
|
|
7
|
+
export declare const useGetValue: (key: string) => import("@firebase/remote-config").Value | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getValue } from "firebase/remote-config";
|
|
2
|
-
import { useRemoteConfig } from "./useRemoteConfig";
|
|
3
2
|
import { useMemo } from "react";
|
|
3
|
+
import { useRemoteConfig } from "./useRemoteConfig";
|
|
4
4
|
/**
|
|
5
5
|
* Custom hook to retrieve a value associated with a specified key from remote configuration.
|
|
6
6
|
* Utilizes memoization to optimize performance by recalculating the result only if dependencies change.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getValue } from "firebase/remote-config";
|
|
2
|
-
import { useRemoteConfig } from "./useRemoteConfig";
|
|
3
2
|
import { useMemo } from "react";
|
|
3
|
+
import { useRemoteConfig } from "./useRemoteConfig";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Custom hook to retrieve a value associated with a specified key from remote configuration.
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Hook to access the Firebase Remote Config instance from the context.
|
|
3
3
|
* @returns {RemoteConfig} The remoteConfig object from the Firebase context.
|
|
4
4
|
*/
|
|
5
|
-
export declare const useRemoteConfig: () => import("firebase/remote-config").RemoteConfig;
|
|
5
|
+
export declare const useRemoteConfig: () => import("@firebase/remote-config").RemoteConfig;
|