Skip to content

EspoCRM – Open Source CRM Application

X-Record-Link-Updated

Yuri Kuznetsov42c54f4c8431
diff --git a/client/src/model.js b/client/src/model.js
index 24bae72b86..9557c975c6 100644
--- a/client/src/model.js
+++ b/client/src/model.js
@@ -528,7 +528,7 @@ class Model {
* wait?: boolean,
* } & Object.<string, *>} [options] Options. Use `patch` to send a PATCH request. If `wait`, attributes will be
* set only after the request is completed.
- * @returns {Promise<Object.<string, *>>}
+ * @returns {Promise<Object.<string, *>> & module:ajax.AjaxPromise}
* @fires Model#sync
* @copyright Credits to Backbone.js.
*/
diff --git a/client/src/views/record/base.js b/client/src/views/record/base.js
index b84f4eea71..67df47df88 100644
--- a/client/src/views/record/base.js
+++ b/client/src/views/record/base.js
@@ -1101,11 +1101,13 @@ class BaseRecordView extends View {
const initialAttributes = this.attributes;
return new Promise((resolve, reject) => {
- model
+ const ajaxPromise = model
.save(setAttributes, {
patch: !model.isNew(),
headers: headers,
- })
+ });
+
+ ajaxPromise
.then(() => {
this.trigger('save', initialAttributes, Object.keys(setAttributes));
@@ -1118,6 +1120,10 @@ class BaseRecordView extends View {
this.trigger('after:save');
model.trigger('after:save');
+ if (ajaxPromise.xhr.getResponseHeader('X-Record-Link-Updated')) {
+ model.trigger('update-all');
+ }
+
resolve();
})
.catch(xhr => {