react-query-firebase 2.13.2 → 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.
Files changed (94) hide show
  1. package/package.json +11 -2
  2. package/react-native/analytics/useLogEvent.js +1 -1
  3. package/react-native/analytics/useLogEvent.ts +1 -1
  4. package/react-native/analytics/useSetAnalyticsCollectionEnabled.js +1 -1
  5. package/react-native/analytics/useSetAnalyticsCollectionEnabled.ts +1 -1
  6. package/react-native/auth/useAuthStateReady.js +1 -1
  7. package/react-native/auth/useAuthStateReady.ts +1 -1
  8. package/react-native/auth/useCreateUserWitEmailAndPasswordMutation.ts +1 -1
  9. package/react-native/auth/useCurrentUser.js +1 -1
  10. package/react-native/auth/useCurrentUser.ts +1 -1
  11. package/react-native/auth/useIdToken.js +2 -2
  12. package/react-native/auth/useIdToken.ts +2 -2
  13. package/react-native/auth/useLinkWithCredentialMutation.ts +1 -1
  14. package/react-native/auth/useReauthenticateWitCredentialMutation.ts +1 -1
  15. package/react-native/auth/useReauthenticateWitRedirectMutation.ts +1 -1
  16. package/react-native/auth/useSendEmailVerificationMutation.ts +1 -1
  17. package/react-native/auth/useSignInAnonymouslyMutation.ts +1 -1
  18. package/react-native/auth/useSignInWitEmailAndPasswordMutation.ts +1 -1
  19. package/react-native/auth/useSignInWitRedirectMutation.ts +1 -1
  20. package/react-native/auth/useSignInWithCredentialMutation.ts +1 -1
  21. package/react-native/auth/useSignOutMutation.ts +1 -1
  22. package/react-native/context/FirebaseContextProvider.js +2 -2
  23. package/react-native/context/FirebaseContextProvider.tsx +2 -2
  24. package/react-native/firestore/useCollectionReference.ts +1 -1
  25. package/react-native/firestore/useCountQuery.d.ts +1 -1
  26. package/react-native/firestore/useCountQuery.ts +1 -1
  27. package/react-native/firestore/useDocReference.d.ts +1 -2
  28. package/react-native/firestore/useDocReference.js +4 -6
  29. package/react-native/firestore/useDocReference.ts +5 -13
  30. package/react-native/firestore/useDocReferences.ts +1 -1
  31. package/react-native/firestore/useGetDocData.d.ts +1 -1
  32. package/react-native/firestore/useGetDocData.js +1 -1
  33. package/react-native/firestore/useGetDocData.ts +2 -2
  34. package/react-native/firestore/useGetRealtimeDocData.ts +1 -1
  35. package/react-native/firestore/useInfiniteQuery.d.ts +1 -1
  36. package/react-native/firestore/useInfiniteQuery.ts +1 -1
  37. package/react-native/firestore/useQuery.d.ts +1 -1
  38. package/react-native/firestore/useQuery.ts +1 -1
  39. package/react-native/firestore/utils/getDocData.d.ts +1 -1
  40. package/react-native/firestore/utils/getDocData.ts +1 -1
  41. package/react-native/firestore/utils/getDocSnap.d.ts +1 -1
  42. package/react-native/firestore/utils/getDocSnap.ts +1 -1
  43. package/react-native/remoteConfig/useFetchAndActivate.js +1 -1
  44. package/react-native/remoteConfig/useFetchAndActivate.ts +1 -1
  45. package/react-native/remoteConfig/useGetValue.js +1 -1
  46. package/react-native/remoteConfig/useGetValue.ts +1 -1
  47. package/web/analytics/useLogEvent.js +1 -1
  48. package/web/analytics/useLogEvent.ts +1 -1
  49. package/web/analytics/useSetAnalyticsCollectionEnabled.js +1 -1
  50. package/web/analytics/useSetAnalyticsCollectionEnabled.ts +1 -1
  51. package/web/auth/useAuthStateReady.js +3 -7
  52. package/web/auth/useAuthStateReady.ts +3 -8
  53. package/web/auth/useCreateUserWitEmailAndPasswordMutation.ts +1 -1
  54. package/web/auth/useCurrentUser.js +1 -1
  55. package/web/auth/useCurrentUser.ts +1 -1
  56. package/web/auth/useGetRedirectResultMutation.js +1 -1
  57. package/web/auth/useGetRedirectResultMutation.ts +2 -2
  58. package/web/auth/useIdToken.js +2 -2
  59. package/web/auth/useIdToken.ts +2 -2
  60. package/web/auth/useLinkWithCredentialMutation.ts +1 -1
  61. package/web/auth/useReauthenticateWitCredentialMutation.ts +1 -1
  62. package/web/auth/useReauthenticateWitRedirectMutation.ts +1 -1
  63. package/web/auth/useSendEmailVerificationMutation.ts +1 -1
  64. package/web/auth/useSignInAnonymouslyMutation.ts +1 -1
  65. package/web/auth/useSignInWitEmailAndPasswordMutation.ts +1 -1
  66. package/web/auth/useSignInWitRedirectMutation.ts +1 -1
  67. package/web/auth/useSignInWithCredentialMutation.ts +1 -1
  68. package/web/auth/useSignOutMutation.ts +1 -1
  69. package/web/context/FirebaseContextProvider.js +2 -2
  70. package/web/context/FirebaseContextProvider.tsx +2 -2
  71. package/web/firestore/useCollectionReference.ts +1 -1
  72. package/web/firestore/useCountQuery.d.ts +1 -1
  73. package/web/firestore/useCountQuery.ts +1 -1
  74. package/web/firestore/useDocReference.d.ts +1 -2
  75. package/web/firestore/useDocReference.js +4 -6
  76. package/web/firestore/useDocReference.ts +5 -12
  77. package/web/firestore/useDocReferences.ts +1 -1
  78. package/web/firestore/useGetDocData.d.ts +1 -1
  79. package/web/firestore/useGetDocData.js +1 -1
  80. package/web/firestore/useGetDocData.ts +2 -2
  81. package/web/firestore/useGetRealtimeDocData.ts +1 -1
  82. package/web/firestore/useInfiniteQuery.d.ts +1 -1
  83. package/web/firestore/useInfiniteQuery.ts +1 -1
  84. package/web/firestore/useQuery.d.ts +1 -1
  85. package/web/firestore/useQuery.ts +1 -1
  86. package/web/firestore/useQueryConstraints.ts +1 -1
  87. package/web/firestore/utils/getDocData.d.ts +1 -1
  88. package/web/firestore/utils/getDocData.ts +1 -1
  89. package/web/firestore/utils/getDocSnap.d.ts +1 -1
  90. package/web/firestore/utils/getDocSnap.ts +1 -1
  91. package/web/remoteConfig/useFetchAndActivate.js +1 -1
  92. package/web/remoteConfig/useFetchAndActivate.ts +1 -1
  93. package/web/remoteConfig/useGetValue.js +1 -1
  94. package/web/remoteConfig/useGetValue.ts +1 -1
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "description": "This module offers react hooks to work with Firebase on react-native and web platforms",
23
23
  "devDependencies": {
24
- "@laverve/eslint-utils": "^5.3.7",
24
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
25
25
  "@react-native-firebase/analytics": "^23.5.0",
26
26
  "@react-native-firebase/app": "^23.5.0",
27
27
  "@react-native-firebase/auth": "^23.5.0",
@@ -31,6 +31,14 @@
31
31
  "@react-native-firebase/remote-config": "^23.5.0",
32
32
  "@tanstack/react-query": "^5.90.6",
33
33
  "@types/react": "^19.2.2",
34
+ "eslint": "^9.39.1",
35
+ "eslint-config-prettier": "^10.1.8",
36
+ "eslint-plugin-import": "^2.32.0",
37
+ "eslint-plugin-jest": "^29.0.1",
38
+ "eslint-plugin-jsonc": "^2.21.0",
39
+ "eslint-plugin-prettier": "^5.5.4",
40
+ "eslint-plugin-react": "^7.37.5",
41
+ "eslint-plugin-react-hooks": "^7.0.1",
34
42
  "firebase": "^12.5.0",
35
43
  "husky": "^9.1.7",
36
44
  "lint-staged": "^16.2.6",
@@ -40,6 +48,7 @@
40
48
  "typedoc-plugin-markdown": "^4.9.0",
41
49
  "typedoc-vitepress-theme": "^1.1.2",
42
50
  "typescript": "^5.9.3",
51
+ "typescript-eslint": "^8.46.3",
43
52
  "vitepress": "^1.6.4"
44
53
  },
45
54
  "homepage": "https://github.com/vpishuk/react-query-firebase",
@@ -75,5 +84,5 @@
75
84
  "docs:build": "vitepress build docs",
76
85
  "docs:preview": "vitepress preview docs"
77
86
  },
78
- "version": "2.13.2"
87
+ "version": "2.13.3"
79
88
  }
@@ -1,6 +1,6 @@
1
1
  import { logEvent } from "@react-native-firebase/analytics";
2
- import { useAnalytics } from "./useAnalytics";
3
2
  import { useCallback, useMemo } from "react";
3
+ import { useAnalytics } from "./useAnalytics";
4
4
  /**
5
5
  * Custom hook to create a log event function that logs an analytics event with specified parameters.
6
6
  * @param {Object} options - The options for the log event.
@@ -1,6 +1,6 @@
1
1
  import { logEvent } from "@react-native-firebase/analytics";
2
- import { useAnalytics } from "./useAnalytics";
3
2
  import { useCallback, useMemo } from "react";
3
+ import { useAnalytics } from "./useAnalytics";
4
4
 
5
5
  type UseLogEventOptions = {
6
6
  eventName: string;
@@ -1,6 +1,6 @@
1
1
  import { setAnalyticsCollectionEnabled } from "@react-native-firebase/analytics";
2
- import { useAnalytics } from "./useAnalytics";
3
2
  import { useEffect } from "react";
3
+ import { useAnalytics } from "./useAnalytics";
4
4
  /**
5
5
  * Custom hook to enable or disable analytics collection
6
6
  * @param {Object} options - The options for hook.
@@ -1,6 +1,6 @@
1
1
  import { setAnalyticsCollectionEnabled } from "@react-native-firebase/analytics";
2
- import { useAnalytics } from "./useAnalytics";
3
2
  import { useEffect } from "react";
3
+ import { useAnalytics } from "./useAnalytics";
4
4
 
5
5
  type UseSetAnalyticsCollectionEnabledOptions = {
6
6
  enabled?: boolean;
@@ -1,6 +1,6 @@
1
1
  import { onAuthStateChanged } from "@react-native-firebase/auth";
2
- import { useAuth } from "./useAuth";
3
2
  import { useEffect, useState } from "react";
3
+ import { useAuth } from "./useAuth";
4
4
  /**
5
5
  * A custom hook that determines if the Firebase authentication state is ready.
6
6
  * It uses Firebase authentication to check if the auth state is ready and updates the state accordingly.
@@ -1,6 +1,6 @@
1
1
  import { onAuthStateChanged } from "@react-native-firebase/auth";
2
- import { useAuth } from "./useAuth";
3
2
  import { useEffect, useState } from "react";
3
+ import { useAuth } from "./useAuth";
4
4
 
5
5
  /**
6
6
  * A custom hook that determines if the Firebase authentication state is ready.
@@ -1,7 +1,7 @@
1
1
  import { useMutation, UseMutationOptions } from "@tanstack/react-query";
2
2
  import { createUserWithEmailAndPassword, FirebaseAuthTypes } from "@react-native-firebase/auth";
3
- import { useAuth } from "./useAuth";
4
3
  import { ReactNativeFirebase } from "@react-native-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 "@react-native-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,6 +1,6 @@
1
1
  import { onAuthStateChanged } from "@react-native-firebase/auth";
2
- import { useAuth } from "./useAuth";
3
2
  import { useEffect, useState } from "react";
3
+ import { useAuth } from "./useAuth";
4
4
 
5
5
  /**
6
6
  * Hook that provides the current authenticated user from Firebase Auth.
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useEffect, useState } from "react";
2
- import { useCurrentUser } from "./useCurrentUser";
3
2
  import { onIdTokenChanged, getIdToken } from "@react-native-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) => {
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useEffect, useState } from "react";
2
- import { useCurrentUser } from "./useCurrentUser";
3
2
  import { onIdTokenChanged, FirebaseAuthTypes, getIdToken } from "@react-native-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, FirebaseAuthTypes } from "@react-native-firebase/auth";
3
3
 
4
- import { LINK_WITH_CREDENTIAL_MUTATION_KEY } from "./mutation-keys";
5
4
  import { ReactNativeFirebase } from "@react-native-firebase/app";
5
+ import { LINK_WITH_CREDENTIAL_MUTATION_KEY } from "./mutation-keys";
6
6
 
7
7
  export type UseLinkWitCredentialMutationVariables = {
8
8
  user: FirebaseAuthTypes.User;
@@ -1,7 +1,7 @@
1
1
  import { useMutation, UseMutationOptions } from "@tanstack/react-query";
2
2
  import { reauthenticateWithCredential, FirebaseAuthTypes } from "@react-native-firebase/auth";
3
- import { REAUTHENTICATE_WITH_CREDENTIAL_MUTATION_KEY } from "./mutation-keys";
4
3
  import { ReactNativeFirebase } from "@react-native-firebase/app";
4
+ import { REAUTHENTICATE_WITH_CREDENTIAL_MUTATION_KEY } from "./mutation-keys";
5
5
 
6
6
  export type UseReauthenticateWitCredentialMutationVariables = {
7
7
  credential: FirebaseAuthTypes.AuthCredential;
@@ -1,8 +1,8 @@
1
1
  import { useMutation, UseMutationOptions } from "@tanstack/react-query";
2
2
  import { reauthenticateWithRedirect, FirebaseAuthTypes, PopupRedirectResolver } from "@react-native-firebase/auth";
3
3
 
4
- import { REAUTHENTICATE_WITH_REDIRECT_MUTATION_KEY } from "./mutation-keys";
5
4
  import { ReactNativeFirebase } from "@react-native-firebase/app";
5
+ import { REAUTHENTICATE_WITH_REDIRECT_MUTATION_KEY } from "./mutation-keys";
6
6
 
7
7
  export type UseReauthenticateWitRedirectMutationVariables = {
8
8
  authProvider: FirebaseAuthTypes.AuthProvider;
@@ -1,8 +1,8 @@
1
1
  import { useMutation, UseMutationOptions } from "@tanstack/react-query";
2
2
  import { sendEmailVerification, FirebaseAuthTypes } from "@react-native-firebase/auth";
3
3
 
4
- import { SEND_EMAIL_VERIFICATION_MUTATION_KEY } from "./mutation-keys";
5
4
  import { ReactNativeFirebase } from "@react-native-firebase/app";
5
+ import { SEND_EMAIL_VERIFICATION_MUTATION_KEY } from "./mutation-keys";
6
6
 
7
7
  export type UseSendEmailVerificationMutationVariables = {
8
8
  user: FirebaseAuthTypes.User;
@@ -1,9 +1,9 @@
1
1
  import { useMutation, UseMutationOptions } from "@tanstack/react-query";
2
2
  import { signInAnonymously, FirebaseAuthTypes } from "@react-native-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, FirebaseAuthTypes } from "@react-native-firebase/auth";
3
3
 
4
+ import { ReactNativeFirebase } from "@react-native-firebase/app";
4
5
  import { useAuth } from "./useAuth";
5
6
  import { SIGN_IN_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY } from "./mutation-keys";
6
- import { ReactNativeFirebase } from "@react-native-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, FirebaseAuthTypes, PopupRedirectResolver } from "@react-native-firebase/auth";
3
3
 
4
+ import { ReactNativeFirebase } from "@react-native-firebase/app";
4
5
  import { useAuth } from "./useAuth";
5
6
  import { SIGN_IN_WITH_REDIRECT_MUTATION_KEY } from "./mutation-keys";
6
- import { ReactNativeFirebase } from "@react-native-firebase/app";
7
7
 
8
8
  export type UseSignInWitRedirectMutationVariables = {
9
9
  authProvider: FirebaseAuthTypes.AuthProvider;
@@ -1,9 +1,9 @@
1
1
  import { useMutation, UseMutationOptions } from "@tanstack/react-query";
2
2
  import { FirebaseAuthTypes, signInWithCredential } from "@react-native-firebase/auth";
3
3
 
4
+ import { ReactNativeFirebase } from "@react-native-firebase/app";
4
5
  import { SIGN_IN_WITH_CREDENTIAL_MUTATION_KEY } from "./mutation-keys";
5
6
  import { useAuth } from "./useAuth";
6
- import { ReactNativeFirebase } from "@react-native-firebase/app";
7
7
 
8
8
  export type UseSignInWithCredentialMutationVariables = {
9
9
  credential: FirebaseAuthTypes.AuthCredential;
@@ -1,8 +1,8 @@
1
1
  import { useMutation, UseMutationOptions } from "@tanstack/react-query";
2
2
  import { signOut } from "@react-native-firebase/auth";
3
3
 
4
- import { SIGN_OUT_MUTATION_KEY } from "./mutation-keys";
5
4
  import { ReactNativeFirebase } from "@react-native-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 { connectAuthEmulator, getAuth } from "@react-native-firebase/auth";
4
3
  import { setAnalyticsCollectionEnabled, setConsent, getAnalytics } from "@react-native-firebase/analytics";
5
4
  import { getRemoteConfig } from "@react-native-firebase/remote-config";
6
5
  import { connectFirestoreEmulator, getFirestore } from "@react-native-firebase/firestore";
7
6
  import { getApp } from "@react-native-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,
@@ -54,7 +54,7 @@ export const FirebaseContextProvider = ({ emulators, children, authEnabled = tru
54
54
  return localFirestore;
55
55
  }
56
56
  return null;
57
- }, [emulators?.firestore, firestoreEnabled, internalFirebase, firestoreSettings]);
57
+ }, [emulators, firestoreEnabled, internalFirebase, firestoreSettings]);
58
58
  const internalAuth = useMemo(() => {
59
59
  if (authEnabled) {
60
60
  const localAuth = getAuth(internalFirebase);
@@ -1,5 +1,4 @@
1
1
  import React, { PropsWithChildren, useEffect, useMemo } from "react";
2
- import { FirebaseContext, FirebaseContextValue } from "./FirebaseContext";
3
2
  import { connectAuthEmulator, getAuth } from "@react-native-firebase/auth";
4
3
  import {
5
4
  FirebaseAnalyticsTypes,
@@ -10,6 +9,7 @@ import {
10
9
  import { FirebaseRemoteConfigTypes, getRemoteConfig } from "@react-native-firebase/remote-config";
11
10
  import { connectFirestoreEmulator, getFirestore } from "@react-native-firebase/firestore";
12
11
  import { ReactNativeFirebase, getApp } from "@react-native-firebase/app";
12
+ import { FirebaseContext, FirebaseContextValue } from "./FirebaseContext";
13
13
 
14
14
  /**
15
15
  * @inline
@@ -204,7 +204,7 @@ export const FirebaseContextProvider: React.FC<FirebaseContextProviderProps> = (
204
204
  }
205
205
 
206
206
  return null;
207
- }, [emulators?.firestore, firestoreEnabled, internalFirebase, firestoreSettings]);
207
+ }, [emulators, firestoreEnabled, internalFirebase, firestoreSettings]);
208
208
 
209
209
  const internalAuth = useMemo(() => {
210
210
  if (authEnabled) {
@@ -1,8 +1,8 @@
1
1
  import { collection, FirebaseFirestoreTypes } from "@react-native-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
@@ -1,7 +1,7 @@
1
1
  import { FirebaseFirestoreTypes, QueryConstraint, QueryNonFilterConstraint } from "@react-native-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
  */
@@ -11,8 +11,8 @@ import {
11
11
  useQuery as useReactQuery,
12
12
  UseQueryOptions as UseReactQueryOptions
13
13
  } from "@tanstack/react-query";
14
- import { QueryFilterConstraint } from "./utils/buildCompositeFilter";
15
14
  import { AppModel } from "../../types";
15
+ import { QueryFilterConstraint } from "./utils/buildCompositeFilter";
16
16
 
17
17
  /**
18
18
  * @inline
@@ -1,4 +1,3 @@
1
- import { FirebaseFirestoreTypes } from "@react-native-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>) => FirebaseFirestoreTypes.DocumentReference<AppModelType> | null;
26
+ export declare const useDocReference: <AppModelType extends AppModel = AppModel>({ path, reference, pathSegments }: UseDocReferenceOptions<AppModelType>) => import("@react-native-firebase/firestore").FirebaseFirestoreTypes.DocumentReference<AppModelType> | null;
@@ -1,4 +1,4 @@
1
- import { useEffect, useRef } from "react";
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
- const ref = useRef(getDocRef({ db, path, pathSegments, reference }));
26
- useEffect(() => {
27
- ref.current = getDocRef({ db, path, pathSegments, reference });
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 { FirebaseFirestoreTypes } from "@react-native-firebase/firestore";
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,7 @@ export const useDocReference = <AppModelType extends AppModel = AppModel>({
38
36
  pathSegments
39
37
  }: UseDocReferenceOptions<AppModelType>) => {
40
38
  const db = useFirestore();
41
- const ref = useRef<FirebaseFirestoreTypes.DocumentReference<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
-
49
- return ref.current;
39
+ return useMemo(() => {
40
+ return getDocRef({ db, path, pathSegments, reference });
41
+ }, [db, path, pathSegments, reference]);
50
42
  };
@@ -1,6 +1,6 @@
1
1
  import { useMemo } from "react";
2
- import { useFirestore } from "./useFirestore";
3
2
  import { AppModel } from "../../types";
3
+ import { useFirestore } from "./useFirestore";
4
4
  import { getDocRef, GetDocRefOptions } from "./utils/getDocRef";
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { GetDocDataOptions } from "./utils/getDocData";
2
1
  import { UseQueryOptions } from "@tanstack/react-query";
3
2
  import { AppModel } from "../../types";
3
+ import { GetDocDataOptions } from "./utils/getDocData";
4
4
  /**
5
5
  * @inline
6
6
  */
@@ -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 { FirebaseFirestoreTypes, onSnapshot } from "@react-native-firebase/fires
2
2
 
3
3
  import { useEffect, useMemo, useState } from "react";
4
4
  import { ReactNativeFirebase } from "@react-native-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 { FirebaseFirestoreTypes, QueryConstraint, QueryNonFilterConstraint } from "@react-native-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
  */
@@ -13,8 +13,8 @@ import {
13
13
  UseInfiniteQueryResult,
14
14
  InfiniteData
15
15
  } from "@tanstack/react-query";
16
- import { QueryFilterConstraint } from "./utils/buildCompositeFilter";
17
16
  import { AppModel } from "../../types";
17
+ import { QueryFilterConstraint } from "./utils/buildCompositeFilter";
18
18
 
19
19
  /**
20
20
  * @inline
@@ -1,7 +1,7 @@
1
1
  import { FirebaseFirestoreTypes, QueryConstraint, QueryNonFilterConstraint } from "@react-native-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
  */
@@ -11,8 +11,8 @@ import {
11
11
  useQuery as useReactQuery,
12
12
  UseQueryOptions as UseReactQueryOptions
13
13
  } from "@tanstack/react-query";
14
- import { QueryFilterConstraint } from "./utils/buildCompositeFilter";
15
14
  import { AppModel } from "../../types";
15
+ import { QueryFilterConstraint } from "./utils/buildCompositeFilter";
16
16
 
17
17
  /**
18
18
  * @inline
@@ -1,5 +1,5 @@
1
- import { GetDocSnapOptions } from "./getDocSnap";
2
1
  import { AppModel } from "../../../types";
2
+ import { GetDocSnapOptions } from "./getDocSnap";
3
3
  /**
4
4
  * @inline
5
5
  */
@@ -1,5 +1,5 @@
1
- import { getDocSnap, GetDocSnapOptions } from "./getDocSnap";
2
1
  import { AppModel } from "../../../types";
2
+ import { getDocSnap, GetDocSnapOptions } from "./getDocSnap";
3
3
 
4
4
  /**
5
5
  * @inline
@@ -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
  */
@@ -1,6 +1,6 @@
1
1
  import { getDoc as firestoreGetDoc } from "@react-native-firebase/firestore";
2
- import { getDocRef, GetDocRefOptions } from "./getDocRef";
3
2
  import { AppModel } from "../../../types";
3
+ import { getDocRef, GetDocRefOptions } from "./getDocRef";
4
4
 
5
5
  /**
6
6
  * @inline
@@ -1,6 +1,6 @@
1
- import { useRemoteConfig } from "./useRemoteConfig";
2
1
  import { ensureInitialized, fetchAndActivate } from "@react-native-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 "@react-native-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.
@@ -1,6 +1,6 @@
1
1
  import { getValue } from "@react-native-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 "@react-native-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.
@@ -1,6 +1,6 @@
1
1
  import { logEvent } from "firebase/analytics";
2
- import { useAnalytics } from "./useAnalytics";
3
2
  import { useCallback, useMemo } from "react";
3
+ import { useAnalytics } from "./useAnalytics";
4
4
  /**
5
5
  * Custom hook to create a log event function that logs an analytics event with specified parameters.
6
6
  * @param {Object} options - The options for the log event.
@@ -1,6 +1,6 @@
1
1
  import { logEvent } from "firebase/analytics";
2
- import { useAnalytics } from "./useAnalytics";
3
2
  import { useCallback, useMemo } from "react";
3
+ import { useAnalytics } from "./useAnalytics";
4
4
 
5
5
  type UseLogEventOptions = {
6
6
  eventName: string;
@@ -1,6 +1,6 @@
1
1
  import { setAnalyticsCollectionEnabled } from "firebase/analytics";
2
- import { useAnalytics } from "./useAnalytics";
3
2
  import { useEffect } from "react";
3
+ import { useAnalytics } from "./useAnalytics";
4
4
  /**
5
5
  * Custom hook to enable or disable analytics collection
6
6
  * @param {Object} options - The options for hook.
@@ -1,6 +1,6 @@
1
1
  import { setAnalyticsCollectionEnabled } from "firebase/analytics";
2
- import { useAnalytics } from "./useAnalytics";
3
2
  import { useEffect } from "react";
3
+ import { useAnalytics } from "./useAnalytics";
4
4
 
5
5
  type UseSetAnalyticsCollectionEnabledOptions = {
6
6
  enabled?: boolean;
@@ -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
- callback();
28
- }, [callback]);
23
+ firebaseAuth.authStateReady().then(() => setIsAuthStateReady(true));
24
+ }, [firebaseAuth]);
29
25
  return isAuthStateReady;
30
26
  };