react-native-onyx 1.0.113 → 1.0.115

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/withOnyx.js CHANGED
@@ -12,7 +12,7 @@ import utils from './utils';
12
12
 
13
13
  // This is a list of keys that can exist on a `mapping`, but are not directly related to loading data from Onyx. When the keys of a mapping are looped over to check
14
14
  // if a key has changed, it's a good idea to skip looking at these properties since they would have unexpected results.
15
- const mappingPropertiesToIgnoreChangesTo = ['initialValue'];
15
+ const mappingPropertiesToIgnoreChangesTo = ['initialValue', 'allowStaleData'];
16
16
 
17
17
  /**
18
18
  * Returns the display name of a component
@@ -119,12 +119,9 @@ export default function (mapOnyxToState, shouldDelayUpdates = false) {
119
119
  const onyxDataFromState = getOnyxDataFromState(this.state, mapOnyxToState);
120
120
  const prevOnyxDataFromState = getOnyxDataFromState(prevState, mapOnyxToState);
121
121
 
122
- // This ensures that only one property is reconnecting at a time, or else it can lead to race conditions and infinite rendering loops. No fun!
123
- let isReconnectingToOnyx = false;
124
-
125
122
  _.each(mapOnyxToState, (mapping, propName) => {
126
- // Some properties can be ignored and also return early if the component is already reconnecting to Onyx
127
- if (_.includes(mappingPropertiesToIgnoreChangesTo, propName) || isReconnectingToOnyx) {
123
+ // Some properties can be ignored because they aren't related to onyx keys and they will never change
124
+ if (_.includes(mappingPropertiesToIgnoreChangesTo, propName)) {
128
125
  return;
129
126
  }
130
127
 
@@ -140,7 +137,6 @@ export default function (mapOnyxToState, shouldDelayUpdates = false) {
140
137
  : Str.result(mapping.key, {...prevProps, ...prevOnyxDataFromState});
141
138
  const newKey = Str.result(mapping.key, {...this.props, ...onyxDataFromState});
142
139
  if (previousKey !== newKey) {
143
- isReconnectingToOnyx = true;
144
140
  Onyx.disconnect(this.activeConnectionIDs[previousKey], previousKey);
145
141
  delete this.activeConnectionIDs[previousKey];
146
142
  this.connectMappingToOnyx(mapping, propName, newKey);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-onyx",
3
- "version": "1.0.113",
3
+ "version": "1.0.115",
4
4
  "author": "Expensify, Inc.",
5
5
  "homepage": "https://expensify.com",
6
6
  "description": "State management for React Native",