react-query-firebase 2.4.0 → 2.4.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 +1 -1
- package/react-native/firestore/useDocReferences.d.ts +1 -1
- package/react-native/firestore/utils/getDocRef.d.ts +1 -1
- package/react-native/firestore/utils/getDocRef.js +2 -2
- package/react-native/firestore/utils/getDocRef.ts +2 -2
- package/web/firestore/useDocReferences.d.ts +1 -1
- package/web/firestore/utils/getDocRef.d.ts +1 -1
- package/web/firestore/utils/getDocRef.js +2 -2
- package/web/firestore/utils/getDocRef.ts +6 -6
package/package.json
CHANGED
|
@@ -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("@react-native-firebase/firestore").FirebaseFirestoreTypes.DocumentReference<AppModelType>[];
|
|
28
|
+
export declare const useDocReferences: <AppModelType extends AppModel = AppModel>({ references }: UseDocReferencesOptions<AppModelType>) => (import("@react-native-firebase/firestore").FirebaseFirestoreTypes.DocumentReference<AppModelType> | null)[];
|
|
@@ -19,4 +19,4 @@ export type GetDocRefOptions<AppModelType extends AppModel = AppModel> = {
|
|
|
19
19
|
*
|
|
20
20
|
* @returns {DocumentReference<AppModelType, AppModelType>} Returns a document reference
|
|
21
21
|
*/
|
|
22
|
-
export declare const getDocRef: <AppModelType extends AppModel = AppModel>({ db, reference, path, pathSegments }: GetDocRefOptions<AppModelType>) => FirebaseFirestoreTypes.DocumentReference<AppModelType
|
|
22
|
+
export declare const getDocRef: <AppModelType extends AppModel = AppModel>({ db, reference, path, pathSegments }: GetDocRefOptions<AppModelType>) => FirebaseFirestoreTypes.DocumentReference<AppModelType> | null;
|
|
@@ -10,8 +10,8 @@ import { doc } from "@react-native-firebase/firestore";
|
|
|
10
10
|
* @returns {DocumentReference<AppModelType, AppModelType>} Returns a document reference
|
|
11
11
|
*/
|
|
12
12
|
export const getDocRef = ({ db, reference, path, pathSegments }) => {
|
|
13
|
-
if (!reference && !path) {
|
|
14
|
-
|
|
13
|
+
if ((!reference && !path) || (reference && !path)) {
|
|
14
|
+
return null;
|
|
15
15
|
}
|
|
16
16
|
const docRef = !reference
|
|
17
17
|
? doc(db, path, ...(pathSegments || []))
|
|
@@ -29,8 +29,8 @@ export const getDocRef = <AppModelType extends AppModel = AppModel>({
|
|
|
29
29
|
path,
|
|
30
30
|
pathSegments
|
|
31
31
|
}: GetDocRefOptions<AppModelType>) => {
|
|
32
|
-
if (!reference && !path) {
|
|
33
|
-
|
|
32
|
+
if ((!reference && !path) || (reference && !path)) {
|
|
33
|
+
return null;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const docRef = !reference
|
|
@@ -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>[];
|
|
28
|
+
export declare const useDocReferences: <AppModelType extends AppModel = AppModel>({ references }: UseDocReferencesOptions<AppModelType>) => (import("@firebase/firestore").DocumentReference<AppModelType, AppModelType> | null)[];
|
|
@@ -19,4 +19,4 @@ export type GetDocRefOptions<AppModelType extends AppModel = AppModel> = {
|
|
|
19
19
|
*
|
|
20
20
|
* @returns {DocumentReference<AppModelType, AppModelType>} Returns a document reference
|
|
21
21
|
*/
|
|
22
|
-
export declare const getDocRef: <AppModelType extends AppModel = AppModel>({ db, reference, path, pathSegments }: GetDocRefOptions<AppModelType>) => DocumentReference<AppModelType, AppModelType
|
|
22
|
+
export declare const getDocRef: <AppModelType extends AppModel = AppModel>({ db, reference, path, pathSegments }: GetDocRefOptions<AppModelType>) => DocumentReference<AppModelType, AppModelType> | null;
|
|
@@ -10,8 +10,8 @@ import { doc } from "firebase/firestore";
|
|
|
10
10
|
* @returns {DocumentReference<AppModelType, AppModelType>} Returns a document reference
|
|
11
11
|
*/
|
|
12
12
|
export const getDocRef = ({ db, reference, path, pathSegments }) => {
|
|
13
|
-
if (!reference && !path) {
|
|
14
|
-
|
|
13
|
+
if ((!reference && !path) || (reference && !path)) {
|
|
14
|
+
return null;
|
|
15
15
|
}
|
|
16
16
|
const docRef = !reference
|
|
17
17
|
? doc(db, path, ...(pathSegments || []))
|
|
@@ -27,17 +27,17 @@ export const getDocRef = <AppModelType extends AppModel = AppModel>({
|
|
|
27
27
|
path,
|
|
28
28
|
pathSegments
|
|
29
29
|
}: GetDocRefOptions<AppModelType>) => {
|
|
30
|
-
if (!reference && !path) {
|
|
31
|
-
|
|
30
|
+
if ((!reference && !path) || (reference && !path)) {
|
|
31
|
+
return null;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const docRef = !reference
|
|
35
|
-
? doc(db, path as string, ...(pathSegments || []))
|
|
35
|
+
? (doc(db, path as string, ...(pathSegments || [])) as DocumentReference<AppModelType, AppModelType>)
|
|
36
36
|
: reference.type === "collection"
|
|
37
|
-
? doc(reference, path, ...(pathSegments || []))
|
|
37
|
+
? (doc(reference, path, ...(pathSegments || [])) as DocumentReference<AppModelType, AppModelType>)
|
|
38
38
|
: reference.type === "document"
|
|
39
|
-
? doc(reference, path as string, ...(pathSegments || []))
|
|
39
|
+
? (doc(reference, path as string, ...(pathSegments || [])) as DocumentReference<AppModelType, AppModelType>)
|
|
40
40
|
: null;
|
|
41
41
|
|
|
42
|
-
return docRef
|
|
42
|
+
return docRef;
|
|
43
43
|
};
|