@umituz/react-native-firebase 2.4.93 → 2.4.95
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-firebase",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.95",
|
|
4
4
|
"description": "Unified Firebase package for React Native apps - Auth and Firestore services using Firebase JS SDK (no native modules).",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -105,9 +105,6 @@
|
|
|
105
105
|
"typescript": "~5.9.2",
|
|
106
106
|
"zustand": "^5.0.3"
|
|
107
107
|
},
|
|
108
|
-
"optionalDependencies": {
|
|
109
|
-
"firebase-admin": "^13.0.2"
|
|
110
|
-
},
|
|
111
108
|
"publishConfig": {
|
|
112
109
|
"access": "public"
|
|
113
110
|
},
|
package/src/domains/firestore/infrastructure/config/initializers/FirebaseFirestoreInitializer.ts
CHANGED
|
@@ -4,12 +4,16 @@
|
|
|
4
4
|
* Single Responsibility: Initialize Firestore instance with optimal caching
|
|
5
5
|
*
|
|
6
6
|
* OPTIMIZATIONS:
|
|
7
|
-
* - Web: Persistent IndexedDB cache (survives restarts)
|
|
8
|
-
* - React Native:
|
|
9
|
-
* - Configurable cache size limits (10 MB default)
|
|
7
|
+
* - Web: Persistent IndexedDB cache (survives restarts) with configurable size
|
|
8
|
+
* - React Native: Memory cache (platform limitation)
|
|
9
|
+
* - Configurable cache size limits (10 MB default for persistent cache)
|
|
10
10
|
* - Platform-aware cache strategy
|
|
11
11
|
*
|
|
12
12
|
* COST SAVINGS: ~90% reduction in network reads through persistent caching
|
|
13
|
+
*
|
|
14
|
+
* NOTE: As of Firebase v10+, cacheSizeBytes must be specified within the cache
|
|
15
|
+
* configuration object (e.g., persistentLocalCache({ cacheSizeBytes })) rather than
|
|
16
|
+
* as a separate Firestore setting. Memory cache doesn't support custom sizes.
|
|
13
17
|
*/
|
|
14
18
|
|
|
15
19
|
import {
|
|
@@ -68,11 +72,13 @@ const Platform = {
|
|
|
68
72
|
function createPersistentCacheConfig(config: Required<FirestoreCacheConfig>): FirestoreSettings {
|
|
69
73
|
try {
|
|
70
74
|
// Create persistent cache with IndexedDB
|
|
71
|
-
|
|
75
|
+
// Note: cacheSizeBytes must be specified inside the cache object, not as a separate setting
|
|
76
|
+
const cacheConfig = persistentLocalCache({
|
|
77
|
+
cacheSizeBytes: config.cacheSizeBytes,
|
|
78
|
+
});
|
|
72
79
|
|
|
73
80
|
return {
|
|
74
81
|
localCache: cacheConfig,
|
|
75
|
-
cacheSizeBytes: config.cacheSizeBytes,
|
|
76
82
|
};
|
|
77
83
|
} catch (error) {
|
|
78
84
|
// If persistent cache fails, fall back to memory cache
|
|
@@ -88,12 +94,12 @@ function createPersistentCacheConfig(config: Required<FirestoreCacheConfig>): Fi
|
|
|
88
94
|
* Uses memory cache for platforms without IndexedDB support
|
|
89
95
|
*/
|
|
90
96
|
function createMemoryCacheConfig(config: Required<FirestoreCacheConfig>): FirestoreSettings {
|
|
91
|
-
// Memory cache -
|
|
97
|
+
// Memory cache - doesn't support cacheSizeBytes parameter
|
|
98
|
+
// Note: memoryLocalCache() doesn't accept any parameters
|
|
92
99
|
const cacheConfig = memoryLocalCache();
|
|
93
100
|
|
|
94
101
|
return {
|
|
95
102
|
localCache: cacheConfig,
|
|
96
|
-
cacheSizeBytes: config.cacheSizeBytes,
|
|
97
103
|
};
|
|
98
104
|
}
|
|
99
105
|
|