From 4ca34940d3bace1cd5d4193da0171ac326e64a5a Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Tue, 10 Aug 2021 11:48:31 +0200 Subject: [PATCH] DEV: ensures container is not destroyed before showing tooltip (#13992) In fast tests it could results in an error. --- .../javascripts/initializers/discourse-local-dates.js.es6 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/discourse-local-dates/assets/javascripts/initializers/discourse-local-dates.js.es6 b/plugins/discourse-local-dates/assets/javascripts/initializers/discourse-local-dates.js.es6 index 108fae47934..68b94e7aebf 100644 --- a/plugins/discourse-local-dates/assets/javascripts/initializers/discourse-local-dates.js.es6 +++ b/plugins/discourse-local-dates/assets/javascripts/initializers/discourse-local-dates.js.es6 @@ -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),