dataflux 1.19.8 → 1.20.0
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/ReactStore.js +17 -5
- package/dist/dataflux.min.js +1 -1
- package/dist/dataflux.min.js.map +1 -1
- package/package.json +1 -1
package/dist/ReactStore.js
CHANGED
|
@@ -81,7 +81,11 @@ var ReactStore = exports["default"] = /*#__PURE__*/function (_ObserverStore) {
|
|
|
81
81
|
}
|
|
82
82
|
return context.___obs_sync_state[key];
|
|
83
83
|
} else {
|
|
84
|
-
|
|
84
|
+
setTimeout(function () {
|
|
85
|
+
return context.setState(function (prev) {
|
|
86
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, key, null));
|
|
87
|
+
});
|
|
88
|
+
}, 0);
|
|
85
89
|
}
|
|
86
90
|
});
|
|
87
91
|
_defineProperty(_this, "didUpdate", function (context) {
|
|
@@ -140,9 +144,14 @@ var ReactStore = exports["default"] = /*#__PURE__*/function (_ObserverStore) {
|
|
|
140
144
|
key: "findAll",
|
|
141
145
|
value: function findAll(type, stateAttribute, context, filterFunction) {
|
|
142
146
|
_assertClassBrand(_ReactStore_brand, this, _fixState).call(this, stateAttribute, context, false);
|
|
147
|
+
context._isMounted = true;
|
|
143
148
|
var subKey = this.subscribe(type, function (data) {
|
|
144
|
-
if (context._isMounted
|
|
145
|
-
|
|
149
|
+
if (context._isMounted) {
|
|
150
|
+
setTimeout(function () {
|
|
151
|
+
return context.setState(function (prev) {
|
|
152
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, stateAttribute, data || []));
|
|
153
|
+
});
|
|
154
|
+
}, 0);
|
|
146
155
|
}
|
|
147
156
|
}, filterFunction);
|
|
148
157
|
_classPrivateFieldGet(_addSubscriptionToContext, this).call(this, context, subKey);
|
|
@@ -152,9 +161,12 @@ var ReactStore = exports["default"] = /*#__PURE__*/function (_ObserverStore) {
|
|
|
152
161
|
key: "findOne",
|
|
153
162
|
value: function findOne(type, stateAttribute, context, filterFunction) {
|
|
154
163
|
_assertClassBrand(_ReactStore_brand, this, _fixState).call(this, stateAttribute, context, true);
|
|
164
|
+
context._isMounted = true;
|
|
155
165
|
var subKey = this.subscribe(type, function (data) {
|
|
156
|
-
if (context._isMounted
|
|
157
|
-
context.setState(
|
|
166
|
+
if (context._isMounted) {
|
|
167
|
+
setTimeout(context.setState(function (prev) {
|
|
168
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, stateAttribute, data && data.length ? data[0] : null));
|
|
169
|
+
}), 0);
|
|
158
170
|
}
|
|
159
171
|
}, filterFunction);
|
|
160
172
|
_classPrivateFieldGet(_addSubscriptionToContext, this).call(this, context, subKey);
|