react-native-onyx 1.0.67 → 1.0.69
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.
|
@@ -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/lib/withOnyx.js
CHANGED
|
@@ -132,14 +132,15 @@ export default function (mapOnyxToState) {
|
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
// Leave untouched previous state to avoid data loss during pre-load updates.
|
|
136
|
+
// This handles case when setState was called before the setWithOnyxState.
|
|
137
|
+
// For example, when an Onyx property was updated by keyChanged before the call of the setWithOnyxState.
|
|
138
|
+
this.setState((prevState) => {
|
|
139
|
+
const remainingTempState = _.omit(this.tempState, _.keys(prevState));
|
|
136
140
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
// setWithOnyxState is called before the state is actually set. This results in unreliable behavior when checking the loading state and has been mainly observed on fabric.
|
|
140
|
-
this.state = stateUpdate;
|
|
141
|
+
return ({...remainingTempState, loading: false});
|
|
142
|
+
});
|
|
141
143
|
|
|
142
|
-
this.setState(stateUpdate); // Trigger a render
|
|
143
144
|
delete this.tempState;
|
|
144
145
|
}
|
|
145
146
|
|