react-native-onyx 1.0.56 → 1.0.57
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 +147 -166
- 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.js +7 -13
- package/package.json +1 -2
package/lib/Onyx.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-continue */
|
|
2
2
|
import {deepEqual} from 'fast-equals';
|
|
3
|
-
import lodashGet from 'lodash/get';
|
|
4
3
|
import _ from 'underscore';
|
|
5
4
|
import * as Logger from './Logger';
|
|
6
5
|
import cache from './OnyxCache';
|
|
@@ -48,17 +47,13 @@ let defaultKeyStates = {};
|
|
|
48
47
|
const deferredInitTask = createDeferredTask();
|
|
49
48
|
|
|
50
49
|
/**
|
|
51
|
-
* Uses a selector
|
|
50
|
+
* Uses a selector function to return a simplified version of sourceData
|
|
52
51
|
* @param {Mixed} sourceData
|
|
53
|
-
* @param {
|
|
52
|
+
* @param {Function} selector Function that takes sourceData and returns a simplified version of it
|
|
54
53
|
* @param {Object} [withOnyxInstanceState]
|
|
55
|
-
* If it's a string, the selector is passed to lodashGet on the sourceData
|
|
56
|
-
* If it's a function, it is passed the sourceData and it should return the simplified data
|
|
57
54
|
* @returns {Mixed}
|
|
58
55
|
*/
|
|
59
|
-
const getSubsetOfData = (sourceData, selector, withOnyxInstanceState) => (
|
|
60
|
-
? selector(sourceData, withOnyxInstanceState)
|
|
61
|
-
: lodashGet(sourceData, selector));
|
|
56
|
+
const getSubsetOfData = (sourceData, selector, withOnyxInstanceState) => selector(sourceData, withOnyxInstanceState);
|
|
62
57
|
|
|
63
58
|
/**
|
|
64
59
|
* Takes a collection of items (eg. {testKey_1:{a:'a'}, testKey_2:{b:'b'}})
|
|
@@ -706,11 +701,10 @@ function getCollectionDataAndSendAsObject(matchingKeys, mapping) {
|
|
|
706
701
|
* @param {Boolean} [mapping.initWithStoredValues] If set to false, then no data will be prefilled into the
|
|
707
702
|
* component
|
|
708
703
|
* @param {Boolean} [mapping.waitForCollectionCallback] If set to true, it will return the entire collection to the callback as a single object
|
|
709
|
-
* @param {
|
|
710
|
-
*
|
|
711
|
-
*
|
|
712
|
-
*
|
|
713
|
-
* be expensive from a performance standpoint).
|
|
704
|
+
* @param {Function} [mapping.selector] THIS PARAM IS ONLY USED WITH withOnyx(). If included, this will be used to subscribe to a subset of an Onyx key's data.
|
|
705
|
+
* The sourceData and withOnyx state are passed to the selector and should return the simplified data. Using this setting on `withOnyx` can have very positive
|
|
706
|
+
* performance benefits because the component will only re-render when the subset of data changes. Otherwise, any change of data on any property would normally
|
|
707
|
+
* cause the component to re-render (and that can be expensive from a performance standpoint).
|
|
714
708
|
* @returns {Number} an ID to use when calling disconnect
|
|
715
709
|
*/
|
|
716
710
|
function connect(mapping) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-onyx",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.57",
|
|
4
4
|
"author": "Expensify, Inc.",
|
|
5
5
|
"homepage": "https://expensify.com",
|
|
6
6
|
"description": "State management for React Native",
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"ascii-table": "0.0.9",
|
|
43
43
|
"fast-equals": "^4.0.3",
|
|
44
|
-
"lodash": "^4.17.21",
|
|
45
44
|
"underscore": "^1.13.1"
|
|
46
45
|
},
|
|
47
46
|
"devDependencies": {
|