react-native-onyx 1.0.68 → 1.0.70

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/lib/Onyx.js CHANGED
@@ -27,8 +27,8 @@ let lastConnectionID = 0;
27
27
  // Holds a mapping of all the react components that want their state subscribed to a store key
28
28
  const callbackToStateMapping = {};
29
29
 
30
- // Keeps a copy of the values of the onyx collection keys as a map for faster lookups
31
- let onyxCollectionKeyMap = {};
30
+ // Stores all of the keys that Onyx can use. Must be defined in init().
31
+ let onyxKeys = {};
32
32
 
33
33
  // Holds a list of keys that have been directly subscribed to or recently modified from least to most recent
34
34
  let recentlyAccessedKeys = [];
@@ -141,7 +141,7 @@ function getAllKeys() {
141
141
  * @returns {Boolean}
142
142
  */
143
143
  function isCollectionKey(key) {
144
- return onyxCollectionKeyMap.has(key);
144
+ return _.contains(_.values(onyxKeys.COLLECTION), key);
145
145
  }
146
146
 
147
147
  /**
@@ -1392,13 +1392,8 @@ function init({
1392
1392
  cache.setRecentKeysLimit(maxCachedKeysCount);
1393
1393
  }
1394
1394
 
1395
- // We need the value of the collection keys later for checking if a
1396
- // key is a collection. We store it in a map for faster lookup.
1397
- const collectionValues = _.values(keys.COLLECTION);
1398
- onyxCollectionKeyMap = _.reduce(collectionValues, (acc, val) => {
1399
- acc.set(val, true);
1400
- return acc;
1401
- }, new Map());
1395
+ // Let Onyx know about all of our keys
1396
+ onyxKeys = keys;
1402
1397
 
1403
1398
  // Set our default key states to use when initializing and clearing Onyx data
1404
1399
  defaultKeyStates = initialKeyStates;
@@ -86,6 +86,9 @@ const provider = {
86
86
  */
87
87
  clear: () => clear(getCustomStore()),
88
88
 
89
+ // This is a noop for now in order to keep clients from crashing see https://github.com/Expensify/Expensify/issues/312438
90
+ setMemoryOnlyKeys: () => {},
91
+
89
92
  /**
90
93
  * Returns all keys available in storage
91
94
  * @returns {Promise<String[]>}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-onyx",
3
- "version": "1.0.68",
3
+ "version": "1.0.70",
4
4
  "author": "Expensify, Inc.",
5
5
  "homepage": "https://expensify.com",
6
6
  "description": "State management for React Native",