react-query-firebase 2.10.0 → 2.10.1

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 CHANGED
@@ -74,5 +74,5 @@
74
74
  "docs:build": "vitepress build docs",
75
75
  "docs:preview": "vitepress preview docs"
76
76
  },
77
- "version": "2.10.0"
77
+ "version": "2.10.1"
78
78
  }
@@ -1,3 +1,4 @@
1
+ import { onAuthStateChanged } from "@react-native-firebase/auth";
1
2
  import { useAuth } from "./useAuth";
2
3
  import { useEffect, useState } from "react";
3
4
  /**
@@ -6,15 +7,15 @@ import { useEffect, useState } from "react";
6
7
  * @returns {Object|null} The current authenticated user object or null if no user is authenticated.
7
8
  */
8
9
  export const useCurrentUser = () => {
9
- const { onAuthStateChanged, currentUser: fbCurrentUser } = useAuth();
10
- const [currentUser, setCurrentUser] = useState(fbCurrentUser);
10
+ const firebaseAuth = useAuth();
11
+ const [currentUser, setCurrentUser] = useState(firebaseAuth.currentUser);
11
12
  useEffect(() => {
12
- const unsubscribe = onAuthStateChanged((user) => {
13
+ const unsubscribe = onAuthStateChanged(firebaseAuth, (user) => {
13
14
  setCurrentUser(user);
14
15
  });
15
16
  return () => {
16
17
  unsubscribe();
17
18
  };
18
- }, [currentUser?.uid, onAuthStateChanged]);
19
+ }, [firebaseAuth]);
19
20
  return currentUser;
20
21
  };
@@ -1,3 +1,4 @@
1
+ import { onAuthStateChanged } from "@react-native-firebase/auth";
1
2
  import { useAuth } from "./useAuth";
2
3
  import { useEffect, useState } from "react";
3
4
 
@@ -7,18 +8,19 @@ import { useEffect, useState } from "react";
7
8
  * @returns {Object|null} The current authenticated user object or null if no user is authenticated.
8
9
  */
9
10
  export const useCurrentUser = () => {
10
- const { onAuthStateChanged, currentUser: fbCurrentUser } = useAuth();
11
+ const firebaseAuth = useAuth();
11
12
 
12
- const [currentUser, setCurrentUser] = useState(fbCurrentUser);
13
+ const [currentUser, setCurrentUser] = useState(firebaseAuth.currentUser);
13
14
 
14
15
  useEffect(() => {
15
- const unsubscribe = onAuthStateChanged((user) => {
16
+ const unsubscribe = onAuthStateChanged(firebaseAuth, (user) => {
16
17
  setCurrentUser(user);
17
18
  });
19
+
18
20
  return () => {
19
21
  unsubscribe();
20
22
  };
21
- }, [currentUser?.uid, onAuthStateChanged]);
23
+ }, [firebaseAuth]);
22
24
 
23
25
  return currentUser;
24
26
  };