fix(navbar): eliminate auth button flash using useSyncExternalStore#4127
fix(navbar): eliminate auth button flash using useSyncExternalStore#4127waleedlatif1 merged 2 commits intostagingfrom
Conversation
PR SummaryLow Risk Overview Updates hidden-state behavior to fade CTAs in via Reviewed by Cursor Bugbot for commit 73e1256. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR fixes the auth button flash on the landing page navbar by replacing the old Confidence Score: 5/5Safe to merge — the useSyncExternalStore pattern is correct, previously-raised accessibility issues are resolved, and there are no P0/P1 findings. All remaining findings are P2 or lower. The useSyncExternalStore implementation correctly uses getServerSnapshot to match SSR output and transitions synchronously to the client snapshot during hydration — eliminating the flash without an extra async render cycle. The inert+aria-hidden pairing (while slightly redundant) is harmless and improves cross-browser compatibility. Prior review concerns about aria-hidden="false" and keyboard focusability have been addressed. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant SSR as Server (SSR)
participant Hydration as Client (Hydration)
participant Client as Client (Post-Hydration)
SSR->>SSR: getServerSnapshot() → false
SSR->>SSR: mounted=false, shouldShow=false
SSR->>SSR: Renders opacity-0 button containers
Hydration->>Hydration: getServerSnapshot() → false (matches SSR)
Hydration->>Hydration: React confirms hydration parity
Hydration->>Hydration: Schedules re-render with getSnapshot()
Client->>Client: getSnapshot() → true
Client->>Client: mounted=true
alt isSessionPending = true
Client->>Client: shouldShow=false, buttons still opacity-0
Client->>Client: Session resolves, isSessionPending=false
Client->>Client: shouldShow=true, fade in 200ms transition
else isSessionPending = false
Client->>Client: shouldShow=true, fade in 200ms transition
end
Reviews (2): Last reviewed commit: "fix(navbar): add inert and fix aria-hidd..." | Re-trigger Greptile |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Hidden buttons remain keyboard-focusable, violating WCAG accessibility
- Added inert attribute to both desktop and mobile auth button containers when hidden, preventing keyboard focus on interactive elements while maintaining the opacity transition.
Or push these changes by commenting:
@cursor push ccfa6da7ba
Preview (ccfa6da7ba)
diff --git a/apps/sim/app/(landing)/components/navbar/navbar.tsx b/apps/sim/app/(landing)/components/navbar/navbar.tsx
--- a/apps/sim/app/(landing)/components/navbar/navbar.tsx
+++ b/apps/sim/app/(landing)/components/navbar/navbar.tsx
@@ -215,6 +215,7 @@
<div
aria-hidden={!shouldShow}
+ inert={shouldShow ? undefined : ''}
className={cn(
'hidden items-center gap-2 pr-16 pl-5 transition-opacity duration-200 lg:flex',
shouldShow ? 'opacity-100' : 'pointer-events-none opacity-0'
@@ -336,6 +337,7 @@
<div
aria-hidden={!shouldShow}
+ inert={shouldShow ? undefined : ''}
className={cn(
'mt-auto flex flex-col gap-2.5 p-5 transition-opacity duration-200',
shouldShow ? 'opacity-100' : 'pointer-events-none opacity-0'This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 73e1256. Configure here.

Summary
useState(false)+useEffect setMountedwithuseSyncExternalStoreto eliminate the auth button flash on the landing page navbargetServerSnapshot: () => falseensures SSR and initial hydration agree (no mismatch), then client snapshot returnstrueimmediately — no extra render cycle on client-side navigationshouldShow = mounted && !isSessionPendingto unify the condition across desktop and mobile button containersinvisibleforopacity-0 pointer-events-none+transition-opacity duration-200so buttons fade in cleanly once auth resolves instead of snappingaria-hiddento both button containers while hidden so invisible buttons are removed from the accessibility treeType of Change
Testing
Tested manually — no flash on page load, buttons fade in correctly for both authenticated and unauthenticated states
Checklist