DEV: Make DTooltipInstance destroy synchronous (#24439)

Having async cleanup on a modifier is problematic because it means it might persist beyond the end of a test, leading to flaky 'Test is not isolated' errors.
This commit is contained in:
David Taylor 2023-11-20 13:27:44 +00:00 committed by GitHub
parent 9d8abcbdfe
commit 0a58564ddd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 9 deletions

View File

@ -56,8 +56,8 @@ export default class DTooltipInstance extends FloatKitInstance {
}
@action
async destroy() {
await this.close();
destroy() {
this.close();
this.tearDownListeners();
}
}

View File

@ -1,6 +1,6 @@
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { cancel, next } from "@ember/runloop";
import { cancel } from "@ember/runloop";
import { makeArray } from "discourse-common/lib/helpers";
import discourseLater from "discourse-common/lib/later";
import { bind } from "discourse-common/utils/decorators";
@ -20,17 +20,13 @@ export default class FloatKitInstance {
content = null;
@action
async show() {
show() {
this.expanded = true;
await new Promise((resolve) => next(resolve));
}
@action
async close() {
close() {
this.expanded = false;
await new Promise((resolve) => next(resolve));
}
@action