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 <noreply@anthropic.com>
This commit is contained in:
Louis King
2026-06-11 23:10:39 +01:00
parent deb5af508c
commit f8ce554d24
@@ -167,7 +167,6 @@ ${flashHtml}
</div>`, 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();