From f8ce554d24a496b5cd5970f66e4388809a7d534b Mon Sep 17 00:00:00 2001 From: Louis King Date: Thu, 11 Jun 2026 23:10:39 +0100 Subject: [PATCH] fix(web): resolve TDZ error on profile page from shadowed signal var The profile page failed to render with "Cannot access 'h' before initialization". The /profile/me branch destructured `signal` from params and used it in the apiGet call, but later redeclared `const signal = ac.signal` in the same block scope. Block-scoped const hoisting put the earlier reference in the temporal dead zone. Drop the redundant inner declaration and pass `ac.signal` directly to the form submit listener. Fixes #233 Co-Authored-By: Claude Opus 4.8 --- src/meshcore_hub/web/static/js/spa/pages/profile.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/meshcore_hub/web/static/js/spa/pages/profile.js b/src/meshcore_hub/web/static/js/spa/pages/profile.js index f74f9b3..8333474 100644 --- a/src/meshcore_hub/web/static/js/spa/pages/profile.js +++ b/src/meshcore_hub/web/static/js/spa/pages/profile.js @@ -167,7 +167,6 @@ ${flashHtml} `, container); const ac = new AbortController(); - const signal = ac.signal; container.querySelector('#profile-form').addEventListener('submit', async (e) => { e.preventDefault(); @@ -184,7 +183,7 @@ ${flashHtml} } catch (err) { router.navigate('/profile?error=' + encodeURIComponent(err.message), true); } - }, { signal }); + }, { signal: ac.signal }); return () => ac.abort();