react-native-onyx 1.0.73 → 1.0.75
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/web.development.js +893 -5678
- package/dist/web.development.js.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/lib/DevTools.js +8 -2
- package/lib/Onyx.js +10 -5
- package/package.json +1 -1
package/lib/DevTools.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import {connectViaExtension} from 'remotedev';
|
|
2
1
|
import _ from 'underscore';
|
|
3
2
|
|
|
3
|
+
const {connectViaExtension} = process.env.NODE_ENV === 'production' ? require('remotedev') : {
|
|
4
|
+
connectViaExtension: () => ({
|
|
5
|
+
init: () => {},
|
|
6
|
+
send: () => {},
|
|
7
|
+
}),
|
|
8
|
+
};
|
|
9
|
+
|
|
4
10
|
class DevTools {
|
|
5
11
|
/**
|
|
6
12
|
* @callback onStateChange
|
|
@@ -42,7 +48,7 @@ class DevTools {
|
|
|
42
48
|
*/
|
|
43
49
|
clearState(keysToBeRemoved = []) {
|
|
44
50
|
const pairs = _.map(keysToBeRemoved, key => [key, undefined]);
|
|
45
|
-
this.registerAction('CLEAR', undefined, _.object(
|
|
51
|
+
this.registerAction('CLEAR', undefined, _.object(pairs));
|
|
46
52
|
}
|
|
47
53
|
}
|
|
48
54
|
|
package/lib/Onyx.js
CHANGED
|
@@ -28,8 +28,8 @@ let lastConnectionID = 0;
|
|
|
28
28
|
// Holds a mapping of all the react components that want their state subscribed to a store key
|
|
29
29
|
const callbackToStateMapping = {};
|
|
30
30
|
|
|
31
|
-
//
|
|
32
|
-
let
|
|
31
|
+
// Keeps a copy of the values of the onyx collection keys as a map for faster lookups
|
|
32
|
+
let onyxCollectionKeyMap = new Map();
|
|
33
33
|
|
|
34
34
|
// Holds a list of keys that have been directly subscribed to or recently modified from least to most recent
|
|
35
35
|
let recentlyAccessedKeys = [];
|
|
@@ -147,7 +147,7 @@ function getAllKeys() {
|
|
|
147
147
|
* @returns {Boolean}
|
|
148
148
|
*/
|
|
149
149
|
function isCollectionKey(key) {
|
|
150
|
-
return
|
|
150
|
+
return onyxCollectionKeyMap.has(key);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
/**
|
|
@@ -1428,8 +1428,13 @@ function init({
|
|
|
1428
1428
|
cache.setRecentKeysLimit(maxCachedKeysCount);
|
|
1429
1429
|
}
|
|
1430
1430
|
|
|
1431
|
-
//
|
|
1432
|
-
|
|
1431
|
+
// We need the value of the collection keys later for checking if a
|
|
1432
|
+
// key is a collection. We store it in a map for faster lookup.
|
|
1433
|
+
const collectionValues = _.values(keys.COLLECTION);
|
|
1434
|
+
onyxCollectionKeyMap = _.reduce(collectionValues, (acc, val) => {
|
|
1435
|
+
acc.set(val, true);
|
|
1436
|
+
return acc;
|
|
1437
|
+
}, new Map());
|
|
1433
1438
|
|
|
1434
1439
|
// Set our default key states to use when initializing and clearing Onyx data
|
|
1435
1440
|
defaultKeyStates = initialKeyStates;
|