FIX: at this point in time component can be destroyed (#19677)

Especially possible in tests
This commit is contained in:
Joffrey JAFFEUX 2023-01-02 19:17:10 +01:00 committed by GitHub
parent cb2f684a43
commit 96e2d92129
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -131,6 +131,10 @@ export default Component.extend({
@action
fetchChannelsFromServer(filter) {
if (this.isDestroyed || this.isDestroying) {
return;
}
this.setProperties({
loading: true,
searchIndex: this.searchIndex + 1,
@ -165,6 +169,10 @@ export default Component.extend({
@action
getInitialChannels() {
if (this.isDestroyed || this.isDestroying) {
return;
}
const channels = this.getChannelsWithFilter(this.filter);
this.set("channels", channels);
this.focusFirstChannel(channels);