react-native-onyx 1.0.66 → 1.0.68
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 +7 -6
- 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/Onyx.d.ts +2 -2
- package/lib/withOnyx.js +7 -6
- package/package.json +1 -1
package/dist/web.development.js
CHANGED
|
@@ -2473,14 +2473,15 @@ function getDisplayName(component) {
|
|
|
2473
2473
|
return;
|
|
2474
2474
|
}
|
|
2475
2475
|
|
|
2476
|
-
|
|
2476
|
+
// Leave untouched previous state to avoid data loss during pre-load updates.
|
|
2477
|
+
// This handles case when setState was called before the setWithOnyxState.
|
|
2478
|
+
// For example, when an Onyx property was updated by keyChanged before the call of the setWithOnyxState.
|
|
2479
|
+
this.setState((prevState) => {
|
|
2480
|
+
const remainingTempState = underscore__WEBPACK_IMPORTED_MODULE_2___default().omit(this.tempState, underscore__WEBPACK_IMPORTED_MODULE_2___default().keys(prevState));
|
|
2477
2481
|
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
// 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.
|
|
2481
|
-
this.state = stateUpdate;
|
|
2482
|
+
return { ...remainingTempState, loading: false };
|
|
2483
|
+
});
|
|
2482
2484
|
|
|
2483
|
-
this.setState(stateUpdate); // Trigger a render
|
|
2484
2485
|
delete this.tempState;
|
|
2485
2486
|
}
|
|
2486
2487
|
|