fix: move init guard to prevent race conditions in email-templates

The initialization guard was placed after the await I18n.loadModule() call,
which could cause race conditions if Alpine calls init() multiple times
before the guard is set. This aligns with the pattern used by other pages.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-04 22:26:05 +01:00
parent 931c178109
commit 3bdf1695fd

View File

@@ -57,12 +57,13 @@ function emailTemplatesPage() {
// Lifecycle
async init() {
// Load i18n translations
await I18n.loadModule('messaging');
// Guard against duplicate initialization
if (window._adminEmailTemplatesInitialized) return;
window._adminEmailTemplatesInitialized = true;
// Load i18n translations
await I18n.loadModule('messaging');
await this.loadData();
},