FIX: Do not attempt to focus topic-list-item after destroy (#22468)

Under certain conditions, this `afterRender` hook can be triggered after the topic-list-item has been removed from the DOM. This is more likely when the 'loading slider' strategy is used on a site.
This commit is contained in:
David Taylor 2023-07-06 15:27:19 +01:00 committed by GitHub
parent 250e3d881d
commit b40347dcac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -63,6 +63,9 @@ export default Component.extend({
htmlSafe(template(this, RUNTIME_OPTIONS))
);
schedule("afterRender", () => {
if (this.isDestroyed || this.isDestroying) {
return;
}
if (this.selected && this.selected.includes(this.topic)) {
this.element.querySelector("input.bulk-select").checked = true;
}