From 46d8429082a26995b4d36d5b6833a42d18e97102 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Mon, 16 Feb 2026 18:34:03 -0700 Subject: [PATCH] fix: update header after auth via requireAuth flow When a user authenticates through the community creation form (via requireAuth), the header bar now re-renders to show the logged-in state instead of still displaying the Sign In button. Co-Authored-By: Claude Opus 4.6 --- lib/rspace-header.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/rspace-header.ts b/lib/rspace-header.ts index 9f57ed7..15de15b 100644 --- a/lib/rspace-header.ts +++ b/lib/rspace-header.ts @@ -433,6 +433,7 @@ interface AuthModalCallbacks { } let activeModal: HTMLElement | null = null; +let headerRenderFn: (() => void) | null = null; /** * Show the EncryptID auth modal for sign-in or registration. @@ -761,6 +762,9 @@ export function mountHeader(options: HeaderOptions): void { }); } + // Store render function so requireAuth can update the header after auth + headerRenderFn = renderHeader; + // Mount to DOM document.body.prepend(header); renderHeader(); @@ -775,6 +779,11 @@ export function requireAuth(onAuthenticated: () => void): boolean { if (isAuthenticated()) { return true; } - showAuthModal({ onSuccess: onAuthenticated }); + showAuthModal({ + onSuccess: () => { + headerRenderFn?.(); + onAuthenticated(); + }, + }); return false; }