react-native-onyx 1.0.84 → 1.0.87

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/OnyxCache.js CHANGED
@@ -179,16 +179,13 @@ class OnyxCache {
179
179
  * Remove keys that don't fall into the range of recently used keys
180
180
  */
181
181
  removeLeastRecentlyUsedKeys() {
182
- if (this.recentKeys.size <= this.maxRecentKeysSize) {
183
- return;
182
+ while (this.recentKeys.size > this.maxRecentKeysSize) {
183
+ const iterator = this.recentKeys.values();
184
+ const value = iterator.next().value;
185
+ if (value !== undefined) {
186
+ this.drop(value);
187
+ }
184
188
  }
185
-
186
- // Get the last N keys by doing a negative slice
187
- const recentlyAccessed = [...this.recentKeys].slice(-this.maxRecentKeysSize);
188
- const storageKeys = _.keys(this.storageMap);
189
- const keysToRemove = _.difference(storageKeys, recentlyAccessed);
190
-
191
- _.each(keysToRemove, this.drop);
192
189
  }
193
190
 
194
191
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-onyx",
3
- "version": "1.0.84",
3
+ "version": "1.0.87",
4
4
  "author": "Expensify, Inc.",
5
5
  "homepage": "https://expensify.com",
6
6
  "description": "State management for React Native",