From e945965f22b5ed37d4444e1528cbf8bf822e4bb5 Mon Sep 17 00:00:00 2001 From: Khai Truong Date: Tue, 17 Sep 2024 15:00:11 +0700 Subject: [PATCH] only load templates when needed --- ext/js/pages/settings/modal-controller.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ext/js/pages/settings/modal-controller.js b/ext/js/pages/settings/modal-controller.js index 2f3213d969..5dac63fb63 100644 --- a/ext/js/pages/settings/modal-controller.js +++ b/ext/js/pages/settings/modal-controller.js @@ -36,10 +36,12 @@ export class ModalController { /** */ async prepare() { - await this._templates.loadFromFiles(['/templates-modals.html']); - for (const name of this._templateNames) { - const template = this._templates.getTemplateContent(name); - document.body.appendChild(template); + if (this._templateNames.length > 0) { + await this._templates.loadFromFiles(['/templates-modals.html']); + for (const name of this._templateNames) { + const template = this._templates.getTemplateContent(name); + document.body.appendChild(template); + } } const idSuffix = '-modal';