dataflux 1.23.1 → 1.23.3
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 +3 -5
- package/dist/Store.js +7 -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
|
@@ -143,9 +143,7 @@ var ReactStore = exports["default"] = /*#__PURE__*/function (_ObserverStore) {
|
|
|
143
143
|
return _createClass(ReactStore, [{
|
|
144
144
|
key: "findAll",
|
|
145
145
|
value: function findAll(type, stateAttribute, context, filterFunction) {
|
|
146
|
-
var _context$_isMounted;
|
|
147
146
|
_assertClassBrand(_ReactStore_brand, this, _fixState).call(this, stateAttribute, context, false);
|
|
148
|
-
(_context$_isMounted = context._isMounted) !== null && _context$_isMounted !== void 0 ? _context$_isMounted : context._isMounted = true;
|
|
149
147
|
var subKey = this.subscribe(type, function (data) {
|
|
150
148
|
if (context._isMounted) {
|
|
151
149
|
setTimeout(function () {
|
|
@@ -161,9 +159,7 @@ var ReactStore = exports["default"] = /*#__PURE__*/function (_ObserverStore) {
|
|
|
161
159
|
}, {
|
|
162
160
|
key: "findOne",
|
|
163
161
|
value: function findOne(type, stateAttribute, context, filterFunction) {
|
|
164
|
-
var _context$_isMounted2;
|
|
165
162
|
_assertClassBrand(_ReactStore_brand, this, _fixState).call(this, stateAttribute, context, true);
|
|
166
|
-
(_context$_isMounted2 = context._isMounted) !== null && _context$_isMounted2 !== void 0 ? _context$_isMounted2 : context._isMounted = true;
|
|
167
163
|
var subKey = this.subscribe(type, function (data) {
|
|
168
164
|
if (context._isMounted) {
|
|
169
165
|
setTimeout(context.setState(function (prev) {
|
|
@@ -177,7 +173,9 @@ var ReactStore = exports["default"] = /*#__PURE__*/function (_ObserverStore) {
|
|
|
177
173
|
}]);
|
|
178
174
|
}(_ObserverStore2["default"]);
|
|
179
175
|
function _fixState(stateAttribute, context, one) {
|
|
180
|
-
|
|
176
|
+
var _context$_isMounted;
|
|
177
|
+
(_context$_isMounted = context._isMounted) !== null && _context$_isMounted !== void 0 ? _context$_isMounted : context._isMounted = true;
|
|
178
|
+
if (context._isMounted && !context[stateAttribute]) {
|
|
181
179
|
context[stateAttribute] = one ? null : []; // side effect on state
|
|
182
180
|
}
|
|
183
181
|
}
|
package/dist/Store.js
CHANGED
|
@@ -306,11 +306,9 @@ var Store = exports["default"] = /*#__PURE__*/function () {
|
|
|
306
306
|
key: "delete",
|
|
307
307
|
value: function _delete(typeOrObjects, filterFunction) {
|
|
308
308
|
if (typeof typeOrObjects === "string" && typeof filterFunction === "function") {
|
|
309
|
-
|
|
310
|
-
return _assertClassBrand(_Store_brand, this, _deleteByFilter).call(this, type, filterFunction);
|
|
309
|
+
return _assertClassBrand(_Store_brand, this, _deleteByFilter).call(this, typeOrObjects, filterFunction);
|
|
311
310
|
} else if (Array.isArray(typeOrObjects) && typeOrObjects.length && !filterFunction) {
|
|
312
|
-
|
|
313
|
-
return Promise.all(objects.map(_classPrivateFieldGet(_deleteByObject, this))).then(function (data) {
|
|
311
|
+
return Promise.all(typeOrObjects.map(_classPrivateFieldGet(_deleteByObject, this))).then(function (data) {
|
|
314
312
|
return data.flat();
|
|
315
313
|
});
|
|
316
314
|
} else {
|
|
@@ -537,7 +535,11 @@ function _deleteByFilter(type, filterFunction) {
|
|
|
537
535
|
try {
|
|
538
536
|
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
539
537
|
var object = _step6.value;
|
|
540
|
-
object.status
|
|
538
|
+
if (object.status === "new") {
|
|
539
|
+
delete _this11.models[type].storedObjects[object.getId()];
|
|
540
|
+
} else {
|
|
541
|
+
object.status = "deleted";
|
|
542
|
+
}
|
|
541
543
|
}
|
|
542
544
|
} catch (err) {
|
|
543
545
|
_iterator6.e(err);
|