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/dist/web.development.js +3 -7
- 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/withOnyx.js +3 -7
- package/package.json +1 -1
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
|
|
127
|
-
if (_.includes(mappingPropertiesToIgnoreChangesTo, propName)
|
|
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);
|