FIX: prevents chat to enter in endless loop when getting 404 (#18867)
Doing DOM operations in finally would cause them to happen even when the request was a failure. Consequence of these DOM operations would be new request, which would also end up in a 404, and so on. This commit simply moves the DOM operations in the then block where it should be safe to make.
This commit is contained in:
@@ -243,6 +243,12 @@ export default Component.extend({
|
||||
return;
|
||||
}
|
||||
this.setMessageProps(messages, fetchingFromLastRead);
|
||||
|
||||
if (this.targetMessageId) {
|
||||
this.highlightOrFetchMessage(this.targetMessageId);
|
||||
}
|
||||
|
||||
this.focusComposer();
|
||||
})
|
||||
.catch(this._handleErrors)
|
||||
.finally(() => {
|
||||
@@ -252,12 +258,6 @@ export default Component.extend({
|
||||
|
||||
this.chat.set("messageId", null);
|
||||
this.set("loading", false);
|
||||
|
||||
if (this.targetMessageId) {
|
||||
this.highlightOrFetchMessage(this.targetMessageId);
|
||||
}
|
||||
|
||||
this.focusComposer();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user