dataflux 1.19.7 → 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/Store.js +2 -2
- package/dist/dataflux.min.js +1 -1
- package/dist/dataflux.min.js.map +1 -1
- package/package.json +6 -6
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);
|
package/dist/Store.js
CHANGED
|
@@ -480,9 +480,9 @@ var Store = exports["default"] = /*#__PURE__*/function () {
|
|
|
480
480
|
var _this1 = this;
|
|
481
481
|
var ifLoaded = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
482
482
|
if (!this.models[type]) {
|
|
483
|
-
return Promise.reject("The model doesn't exist");
|
|
483
|
+
return Promise.reject("The model ".concat(type, " doesn't exist"));
|
|
484
484
|
} else if (!this.models[type].promise && !this.options.lazyLoad) {
|
|
485
|
-
return Promise.reject("The model is not loaded");
|
|
485
|
+
return Promise.reject("The model ".concat(type, " is not loaded"));
|
|
486
486
|
} else if (!this.models[type].promise && this.options.lazyLoad && !ifLoaded) {
|
|
487
487
|
return _assertClassBrand(_Store_brand, this, _loadObjects).call(this, type).then(function () {
|
|
488
488
|
return _this1.models[type].promise;
|