react-native-onyx 3.0.103 → 3.0.105
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/dist/OnyxCache.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.TASK = void 0;
|
|
7
7
|
const fast_equals_1 = require("fast-equals");
|
|
8
|
-
const
|
|
8
|
+
const lodash_bindall_1 = __importDefault(require("lodash.bindall"));
|
|
9
9
|
const utils_1 = __importDefault(require("./utils"));
|
|
10
10
|
const OnyxKeys_1 = __importDefault(require("./OnyxKeys"));
|
|
11
11
|
/**
|
|
@@ -47,7 +47,7 @@ class OnyxCache {
|
|
|
47
47
|
this.collectionSnapshots = new Map();
|
|
48
48
|
this.dirtyCollections = new Set();
|
|
49
49
|
// bind all public methods to prevent problems with `this`
|
|
50
|
-
(0,
|
|
50
|
+
(0, lodash_bindall_1.default)(this, 'getAllKeys', 'get', 'hasCacheForKey', 'addKey', 'addNullishStorageKey', 'hasNullishStorageKey', 'clearNullishStorageKeys', 'set', 'drop', 'merge', 'hydrate', 'hasPendingTask', 'getTaskPromise', 'captureTask', 'setAllKeys', 'setEvictionAllowList', 'isEvictableKey', 'removeLastAccessedKey', 'addLastAccessedKey', 'addEvictableKeysToRecentlyAccessedList', 'getKeyForEviction', 'setCollectionKeys', 'hasValueChanged', 'getCollectionData');
|
|
51
51
|
}
|
|
52
52
|
/** Get all the storage keys */
|
|
53
53
|
getAllKeys() {
|
|
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
const
|
|
39
|
+
const lodash_bindall_1 = __importDefault(require("lodash.bindall"));
|
|
40
40
|
const Logger = __importStar(require("./Logger"));
|
|
41
41
|
const OnyxUtils_1 = __importDefault(require("./OnyxUtils"));
|
|
42
42
|
const OnyxKeys_1 = __importDefault(require("./OnyxKeys"));
|
|
@@ -51,7 +51,7 @@ class OnyxConnectionManager {
|
|
|
51
51
|
this.lastCallbackID = 0;
|
|
52
52
|
this.sessionID = Str.guid();
|
|
53
53
|
// Binds all public methods to prevent problems with `this`.
|
|
54
|
-
(0,
|
|
54
|
+
(0, lodash_bindall_1.default)(this, 'generateConnectionID', 'fireCallbacks', 'connect', 'disconnect', 'disconnectAll', 'refreshSessionID');
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* Generates a connection ID based on the `connectOptions` object passed to the function.
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
declare function NOOP(..._args: unknown[]): void;
|
|
1
2
|
/**
|
|
2
3
|
* This is used to keep multiple browser tabs in sync, therefore only needed on web
|
|
3
4
|
* On native platforms, we omit this syncing logic by setting this to mock implementation.
|
|
4
5
|
*/
|
|
5
6
|
declare const InstanceSync: {
|
|
6
7
|
shouldBeUsed: boolean;
|
|
7
|
-
init:
|
|
8
|
-
setItem:
|
|
9
|
-
removeItem:
|
|
10
|
-
removeItems:
|
|
11
|
-
multiMerge:
|
|
12
|
-
multiSet:
|
|
13
|
-
mergeItem:
|
|
8
|
+
init: typeof NOOP;
|
|
9
|
+
setItem: typeof NOOP;
|
|
10
|
+
removeItem: typeof NOOP;
|
|
11
|
+
removeItems: typeof NOOP;
|
|
12
|
+
multiMerge: typeof NOOP;
|
|
13
|
+
multiSet: typeof NOOP;
|
|
14
|
+
mergeItem: typeof NOOP;
|
|
14
15
|
clear: <T extends () => void>(callback: T) => Promise<void>;
|
|
15
16
|
};
|
|
16
17
|
export default InstanceSync;
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
3
|
+
function NOOP(..._args) {
|
|
4
|
+
// Native InstanceSync is a no-op; web implements real cross-tab sync.
|
|
5
|
+
}
|
|
7
6
|
/**
|
|
8
7
|
* This is used to keep multiple browser tabs in sync, therefore only needed on web
|
|
9
8
|
* On native platforms, we omit this syncing logic by setting this to mock implementation.
|
|
10
9
|
*/
|
|
11
10
|
const InstanceSync = {
|
|
12
11
|
shouldBeUsed: false,
|
|
13
|
-
init:
|
|
14
|
-
setItem:
|
|
15
|
-
removeItem:
|
|
16
|
-
removeItems:
|
|
17
|
-
multiMerge:
|
|
18
|
-
multiSet:
|
|
19
|
-
mergeItem:
|
|
12
|
+
init: NOOP,
|
|
13
|
+
setItem: NOOP,
|
|
14
|
+
removeItem: NOOP,
|
|
15
|
+
removeItems: NOOP,
|
|
16
|
+
multiMerge: NOOP,
|
|
17
|
+
multiSet: NOOP,
|
|
18
|
+
mergeItem: NOOP,
|
|
20
19
|
clear: (callback) => Promise.resolve(callback()),
|
|
21
20
|
};
|
|
22
21
|
exports.default = InstanceSync;
|
package/dist/storage/index.js
CHANGED
|
@@ -50,7 +50,14 @@ const initPromise = new Promise((resolve) => {
|
|
|
50
50
|
* Degrade performance by removing the storage provider and only using cache
|
|
51
51
|
*/
|
|
52
52
|
function degradePerformance(error) {
|
|
53
|
-
|
|
53
|
+
let causeMessage = '';
|
|
54
|
+
if (error.cause instanceof Error) {
|
|
55
|
+
causeMessage = error.cause.message;
|
|
56
|
+
}
|
|
57
|
+
else if (typeof error.cause === 'string') {
|
|
58
|
+
causeMessage = error.cause;
|
|
59
|
+
}
|
|
60
|
+
Logger.logHmmm(`Error while using ${provider.name}. Falling back to only using cache and dropping storage.\n Error: ${error.message}\n Stack: ${error.stack}\n Cause: ${causeMessage}`);
|
|
54
61
|
console.error(error);
|
|
55
62
|
provider = MemoryOnlyProvider_1.default;
|
|
56
63
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-onyx",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.105",
|
|
4
4
|
"author": "Expensify, Inc.",
|
|
5
5
|
"homepage": "https://expensify.com",
|
|
6
6
|
"description": "State management for React Native",
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"@types/jest": "^29.5.14",
|
|
66
66
|
"@types/jsdoc-to-markdown": "^7.0.6",
|
|
67
67
|
"@types/lodash": "^4.14.202",
|
|
68
|
+
"@types/lodash.bindall": "^4.4.9",
|
|
68
69
|
"@types/node": "^20.11.5",
|
|
69
70
|
"@types/react": "^18.2.14",
|
|
70
71
|
"@types/react-native": "^0.70.0",
|