diff --git a/app/assets/javascripts/discourse/app/initializers/ember-events.js b/app/assets/javascripts/discourse/app/initializers/ember-events.js index 98c2a241a3c..a359c0bb060 100644 --- a/app/assets/javascripts/discourse/app/initializers/ember-events.js +++ b/app/assets/javascripts/discourse/app/initializers/ember-events.js @@ -1,9 +1,15 @@ +let initializedOnce = false; + export default { name: "ember-events", initialize: function () { // By default Ember listens to too many events. This tells it the only events - // we're interested in. + // we're interested in. (it removes mousemove and touchmove) + if (initializedOnce) { + return; + } + Ember.EventDispatcher.reopen({ events: { touchstart: "touchStart", @@ -33,5 +39,7 @@ export default { dragend: "dragEnd", }, }); + + initializedOnce = true; }, }; diff --git a/app/assets/javascripts/discourse/app/initializers/ember-input-component-extension.js b/app/assets/javascripts/discourse/app/initializers/ember-input-component-extension.js index 902f7958c62..841ff0e9929 100644 --- a/app/assets/javascripts/discourse/app/initializers/ember-input-component-extension.js +++ b/app/assets/javascripts/discourse/app/initializers/ember-input-component-extension.js @@ -1,15 +1,22 @@ import TextField from "@ember/component/text-field"; import TextArea from "@ember/component/text-area"; +let initializedOnce = false; export default { name: "ember-input-component-extensions", initialize() { + if (initializedOnce) { + return; + } + TextField.reopen({ attributeBindings: ["aria-describedby", "aria-invalid"], }); TextArea.reopen({ attributeBindings: ["aria-describedby", "aria-invalid"], }); + + initializedOnce = true; }, }; diff --git a/app/assets/javascripts/discourse/app/initializers/ember-link-component-extension.js b/app/assets/javascripts/discourse/app/initializers/ember-link-component-extension.js index 807b58e39f6..33accacf112 100644 --- a/app/assets/javascripts/discourse/app/initializers/ember-link-component-extension.js +++ b/app/assets/javascripts/discourse/app/initializers/ember-link-component-extension.js @@ -1,9 +1,17 @@ +let initializedOnce = false; + export default { name: "ember-link-component-extensions", initialize() { + if (initializedOnce) { + return; + } + Ember.LinkComponent.reopen({ attributeBindings: ["name"], }); + + initializedOnce = true; }, }; diff --git a/app/assets/javascripts/discourse/app/initializers/logs-notice.js b/app/assets/javascripts/discourse/app/initializers/logs-notice.js index 08867d129d8..164f5074485 100644 --- a/app/assets/javascripts/discourse/app/initializers/logs-notice.js +++ b/app/assets/javascripts/discourse/app/initializers/logs-notice.js @@ -1,11 +1,16 @@ import LogsNotice from "discourse/services/logs-notice"; import Singleton from "discourse/mixins/singleton"; +let initializedOnce = false; export default { name: "logs-notice", after: "message-bus", initialize: function (container) { + if (initializedOnce) { + return; + } + const siteSettings = container.lookup("site-settings:main"); const messageBus = container.lookup("message-bus:main"); const keyValueStore = container.lookup("key-value-store:main"); @@ -20,5 +25,7 @@ export default { }); }, }); + + initializedOnce = true; }, };