react-query-firebase 3.3.2 → 3.4.0
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.
|
@@ -79,6 +79,11 @@ export type FirebaseContextProviderProps = PropsWithChildren & {
|
|
|
79
79
|
* @defaultValue {}
|
|
80
80
|
*/
|
|
81
81
|
firestoreSettings?: FirestoreSettings;
|
|
82
|
+
/**
|
|
83
|
+
* Specifies custom firestore database identifier
|
|
84
|
+
* @defaultValue `(default)`
|
|
85
|
+
*/
|
|
86
|
+
firestoreDBId?: string;
|
|
82
87
|
/**
|
|
83
88
|
* Flag indicating whether Firebase Firestore should be enabled.
|
|
84
89
|
* @defaultValue `true`
|
|
@@ -29,7 +29,7 @@ import { FirebaseContext } from "./FirebaseContext.js";
|
|
|
29
29
|
* };
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
export const FirebaseContextProvider = ({ emulators, children, authEnabled = true, firestoreEnabled = true, analyticsEnabled = true, consentSettings = {}, remoteConfigEnabled = true, remoteConfigSettings, remoteConfigDefaults = {}, firestoreSettings }) => {
|
|
32
|
+
export const FirebaseContextProvider = ({ emulators, children, authEnabled = true, firestoreEnabled = true, analyticsEnabled = true, consentSettings = {}, remoteConfigEnabled = true, remoteConfigSettings, remoteConfigDefaults = {}, firestoreSettings, firestoreDBId = "(default)" }) => {
|
|
33
33
|
const internalFirebase = useMemo(() => getApp(), []);
|
|
34
34
|
useEffect(() => {
|
|
35
35
|
setConsent(getAnalytics(internalFirebase), {
|
|
@@ -43,16 +43,19 @@ export const FirebaseContextProvider = ({ emulators, children, authEnabled = tru
|
|
|
43
43
|
...consentSettings
|
|
44
44
|
});
|
|
45
45
|
}, [consentSettings, internalFirebase]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
initializeFirestore(internalFirebase, firestoreSettings || {});
|
|
48
|
+
}, [firestoreSettings, internalFirebase]);
|
|
46
49
|
const internalFirestore = useMemo(() => {
|
|
47
50
|
if (firestoreEnabled) {
|
|
48
51
|
if (emulators?.firestore?.host && emulators?.firestore?.port) {
|
|
49
52
|
connectFirestoreEmulator(getFirestore(internalFirebase), emulators.firestore.host, emulators.firestore.port);
|
|
50
53
|
}
|
|
51
|
-
const localFirestore =
|
|
54
|
+
const localFirestore = getFirestore(internalFirebase, firestoreDBId);
|
|
52
55
|
return localFirestore;
|
|
53
56
|
}
|
|
54
57
|
return null;
|
|
55
|
-
}, [emulators, firestoreEnabled, internalFirebase,
|
|
58
|
+
}, [emulators, firestoreEnabled, internalFirebase, firestoreDBId]);
|
|
56
59
|
const internalAuth = useMemo(() => {
|
|
57
60
|
if (authEnabled) {
|
|
58
61
|
const localAuth = getAuth(internalFirebase);
|
|
@@ -89,7 +92,7 @@ export const FirebaseContextProvider = ({ emulators, children, authEnabled = tru
|
|
|
89
92
|
analytics: internalAnalytics,
|
|
90
93
|
firestore: internalFirestore,
|
|
91
94
|
remoteConfig: internalRemoteConfig,
|
|
92
|
-
|
|
95
|
+
messaging: getMessaging(internalFirebase)
|
|
93
96
|
}), [internalFirebase, internalAuth, internalAnalytics, internalFirestore, internalRemoteConfig]);
|
|
94
97
|
useEffect(() => {
|
|
95
98
|
if (contextValue.analytics) {
|
|
@@ -84,6 +84,11 @@ export type FirebaseContextProviderProps = PropsWithChildren & {
|
|
|
84
84
|
* @defaultValue `true`
|
|
85
85
|
*/
|
|
86
86
|
firestoreEnabled?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Specifies custom firestore database identifier
|
|
89
|
+
* @defaultValue `(default)`
|
|
90
|
+
*/
|
|
91
|
+
firestoreDBId?: string;
|
|
87
92
|
/**
|
|
88
93
|
* Configuration options for Firebase Remote Config Settings. {@link https://firebase.google.com/docs/reference/js/remote-config.remoteconfigsettings | Learn about the Firebase Remote COnfig Settings object}
|
|
89
94
|
* @defaultValue `true`
|
|
@@ -29,7 +29,7 @@ import { FirebaseContext } from "./FirebaseContext.js";
|
|
|
29
29
|
* };
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
export const FirebaseContextProvider = ({ emulators, options, children, authEnabled = true, firestoreEnabled = true, analyticsEnabled = true, consentSettings = {}, remoteConfigEnabled = true, remoteConfigSettings, remoteConfigDefaults = {}, firestoreSettings, authPersistenceType }) => {
|
|
32
|
+
export const FirebaseContextProvider = ({ emulators, options, children, authEnabled = true, firestoreEnabled = true, analyticsEnabled = true, consentSettings = {}, remoteConfigEnabled = true, remoteConfigSettings, remoteConfigDefaults = {}, firestoreSettings, authPersistenceType, firestoreDBId = "(default)" }) => {
|
|
33
33
|
const firebase = useMemo(() => {
|
|
34
34
|
return initializeApp(options);
|
|
35
35
|
}, [options]);
|
|
@@ -47,14 +47,14 @@ export const FirebaseContextProvider = ({ emulators, options, children, authEnab
|
|
|
47
47
|
}, [consentSettings]);
|
|
48
48
|
const firestore = useMemo(() => {
|
|
49
49
|
if (firestoreEnabled) {
|
|
50
|
-
const localFirestore = initializeFirestore(firebase, firestoreSettings || {});
|
|
50
|
+
const localFirestore = initializeFirestore(firebase, firestoreSettings || {}, firestoreDBId);
|
|
51
51
|
if (emulators?.firestore?.host && emulators?.firestore?.port) {
|
|
52
52
|
connectFirestoreEmulator(localFirestore, emulators.firestore.host, emulators.firestore.port);
|
|
53
53
|
}
|
|
54
54
|
return localFirestore;
|
|
55
55
|
}
|
|
56
56
|
return null;
|
|
57
|
-
}, [firestoreSettings, emulators, firestoreEnabled, firebase]);
|
|
57
|
+
}, [firestoreSettings, emulators, firestoreEnabled, firebase, firestoreDBId]);
|
|
58
58
|
const authPersistence = useMemo(() => {
|
|
59
59
|
switch (authPersistenceType) {
|
|
60
60
|
case "NONE":
|
package/package.json
CHANGED
|
@@ -31,26 +31,26 @@
|
|
|
31
31
|
"@react-native-firebase/installations": "^24.0.0",
|
|
32
32
|
"@react-native-firebase/messaging": "^24.0.0",
|
|
33
33
|
"@react-native-firebase/remote-config": "^24.0.0",
|
|
34
|
-
"@tanstack/react-query": "^5.
|
|
34
|
+
"@tanstack/react-query": "^5.100.11",
|
|
35
35
|
"@types/react": "^19.2.14",
|
|
36
36
|
"eslint": "^9.39.4",
|
|
37
37
|
"eslint-config-prettier": "^10.1.8",
|
|
38
38
|
"eslint-plugin-import": "^2.32.0",
|
|
39
39
|
"eslint-plugin-jest": "^29.15.2",
|
|
40
|
-
"eslint-plugin-jsonc": "^
|
|
40
|
+
"eslint-plugin-jsonc": "^3.1.2",
|
|
41
41
|
"eslint-plugin-prettier": "^5.5.5",
|
|
42
42
|
"eslint-plugin-react": "^7.37.5",
|
|
43
43
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
44
|
-
"firebase": "^12.
|
|
44
|
+
"firebase": "^12.13.0",
|
|
45
45
|
"husky": "^9.1.7",
|
|
46
|
-
"lint-staged": "^
|
|
46
|
+
"lint-staged": "^17.0.5",
|
|
47
47
|
"prettier": "^3.8.3",
|
|
48
|
-
"react": "^19.2.
|
|
48
|
+
"react": "^19.2.6",
|
|
49
49
|
"typedoc": "^0.28.19",
|
|
50
50
|
"typedoc-plugin-markdown": "^4.11.0",
|
|
51
51
|
"typedoc-vitepress-theme": "^1.1.2",
|
|
52
52
|
"typescript": "^5.9.3",
|
|
53
|
-
"typescript-eslint": "^8.59.
|
|
53
|
+
"typescript-eslint": "^8.59.4",
|
|
54
54
|
"vitepress": "^1.6.4"
|
|
55
55
|
},
|
|
56
56
|
"homepage": "https://github.com/vpishuk/react-query-firebase",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"docs:build": "vitepress build docs",
|
|
94
94
|
"docs:preview": "vitepress preview docs"
|
|
95
95
|
},
|
|
96
|
-
"version": "3.
|
|
96
|
+
"version": "3.4.0"
|
|
97
97
|
}
|