Skip to content

Commit

Permalink
only load templates when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
khaitruong922 committed Sep 17, 2024
1 parent 81df587 commit e945965
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ext/js/pages/settings/modal-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit e945965

Please sign in to comment.