DEV: ensures container is not destroyed before showing tooltip (#13992)

In fast tests it could results in an error.
This commit is contained in:
Joffrey JAFFEUX 2021-08-10 11:48:31 +02:00 committed by GitHub
parent 2efe91f49f
commit 4ca34940d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -130,8 +130,12 @@ export default {
name: "discourse-local-dates",
showDatePopover(event) {
const siteSettings = getOwner(this).lookup("site-settings:main");
const owner = getOwner(this);
if (owner.isDestroyed || owner.isDestroying) {
return;
}
const siteSettings = owner.lookup("site-settings:main");
if (event?.target?.classList?.contains("discourse-local-date")) {
showPopover(event, {
htmlContent: buildHtmlPreview(event.target, siteSettings),