Skip to content

Commit 6d8cc9d

Browse files
committed
Prevent re-renders if specifying options in hooks. Fixes #207
1 parent 05d2fc1 commit 6d8cc9d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

auth/useAuthState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default (auth: Auth, options?: AuthStateOptions): AuthStateHook => {
3434
return () => {
3535
listener();
3636
};
37-
}, [auth, options]);
37+
}, [auth]);
3838

3939
const resArray: AuthStateHook = [value, loading, error];
4040
return useMemo<AuthStateHook>(() => resArray, resArray);

firestore/useCollection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const useCollection = <T = DocumentData>(
5151
return () => {
5252
unsubscribe();
5353
};
54-
}, [ref.current, options]);
54+
}, [ref.current]);
5555

5656
const resArray: CollectionHook<T> = [
5757
value as QuerySnapshot<T>,
@@ -100,7 +100,7 @@ export const useCollectionOnce = <T = DocumentData>(
100100
return () => {
101101
effectActive = false;
102102
};
103-
}, [ref.current, options]);
103+
}, [ref.current]);
104104

105105
const resArray: CollectionOnceHook<T> = [
106106
value as QuerySnapshot<T>,

firestore/useDocument.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const useDocument = <T = DocumentData>(
5050
return () => {
5151
unsubscribe();
5252
};
53-
}, [ref.current, options]);
53+
}, [ref.current]);
5454

5555
const resArray: DocumentHook<T> = [
5656
value as DocumentSnapshot<T>,
@@ -104,7 +104,7 @@ export const useDocumentOnce = <T = DocumentData>(
104104
return () => {
105105
effectActive = false;
106106
};
107-
}, [ref.current, options]);
107+
}, [ref.current]);
108108

109109
const resArray: DocumentOnceHook<T> = [
110110
value as DocumentSnapshot<T>,

0 commit comments

Comments
 (0)