Remove complexity around promise/non-promise.
Since this is in a promise chain, it doesn't matter if onUpdateProjectData returns a promise or a primitive, it'll work either way
This commit is contained in:
1 parent
7709580710
commit
00a4db1213
1 file changed
+2
-10
@@ -232,16 +232,8 @@ const ProjectSaverHOC = function (WrappedComponent) {
|
||||
() => (asset.clean = true)
|
||||
)
|
||||
)
|
||||
).then(() => {
|
||||
const {onUpdateProjectData} = this.props;
|
||||
const saveReturnValue = onUpdateProjectData(projectId,
|
||||
savedVMState, requestParams);
|
||||
// Allow onUpdateProjectData to either return immediately or a promise.
|
||||
if (!(saveReturnValue.then && saveReturnValue.catch)) {
|
||||
return Promise.resolve(saveReturnValue);
|
||||
}
|
||||
return saveReturnValue;
|
||||
})
|
||||
)
|
||||
.then(() => this.props.onUpdateProjectData(projectId, savedVMState, requestParams))
|
||||
.then(response => {
|
||||
this.props.onSetProjectUnchanged();
|
||||
const id = response.id.toString();
|
||||
|
||||
Reference in new issue
Block a user