redux-flute
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -125,3 +125,12 @@ "use strict"; | ||
}).then(function (data) { | ||
var newModelData = _extends({}, recordForAction, data), | ||
// This will overwrite all Rails-style nested attributes (addresses_attributes) | ||
// to blank objects each time they are successfully sent back to an API. | ||
// TODO: Should move into a setting and test. | ||
var recordForActionWithRailsStyleNestedAttributesBlanked = Object.keys(recordForAction).filter(function (attribute) { | ||
return attribute.match(/_attributes$/); | ||
}).reduce(function (attrs, attr) { | ||
attrs[attr] = {}; | ||
return attrs; | ||
}, _extends({}, recordForAction)), | ||
newModelData = _extends({}, recordForActionWithRailsStyleNestedAttributesBlanked, data), | ||
newModel = new model(newModelData); | ||
@@ -128,0 +137,0 @@ _this.dispatch({ type: "@FLUTE_" + method + "_SUCCESS_" + modelTypeForAction, record: newModelData }); |
{ | ||
"name": "redux-flute", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "Smart front-end data cache manager", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -85,3 +85,12 @@ import Sugar from "./sugar" | ||
.then(data=>{ | ||
const newModelData = {...recordForAction, ...data}, | ||
// This will overwrite all Rails-style nested attributes (addresses_attributes) | ||
// to blank objects each time they are successfully sent back to an API. | ||
// TODO: Should move into a setting and test. | ||
const recordForActionWithRailsStyleNestedAttributesBlanked = Object.keys(recordForAction) | ||
.filter(attribute=>(attribute.match(/_attributes$/))) | ||
.reduce((attrs, attr)=>{ | ||
attrs[attr] = {} | ||
return attrs; | ||
}, {...recordForAction}), | ||
newModelData = {...recordForActionWithRailsStyleNestedAttributesBlanked, ...data}, | ||
newModel = new model(newModelData); | ||
@@ -88,0 +97,0 @@ this.dispatch({ type: `@FLUTE_${method}_SUCCESS_${modelTypeForAction}`, record:newModelData }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
189396
15
4522