Skip to content

[codex] Keep desktop app available when Clerk UI fails#3049

Open
juliusmarminge wants to merge 2 commits into
mainfrom
codex/clerk-startup-fail-open
Open

[codex] Keep desktop app available when Clerk UI fails#3049
juliusmarminge wants to merge 2 commits into
mainfrom
codex/clerk-startup-fail-open

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

  • mount the desktop Clerk provider immediately instead of withholding the entire app until the remote Clerk UI bundle loads
  • pass Clerk UI loading to the provider as a pending thenable and retain failure logging
  • add a browser regression test proving application content remains visible when the Clerk UI script fails

Root cause

DesktopClerkProvider returned null while waiting for the UI bundle from clerk.t3.codes. Blocking or failing that optional script therefore prevented the router and all application content from mounting.

Impact

The desktop app remains usable when Clerk UI infrastructure is unavailable. Clerk hooks still receive the real provider context, while UI-dependent authentication surfaces remain unavailable until the bundle loads.

Validation

  • vp check
  • vp run typecheck
  • vp test run --project browser src/components/clerk/DesktopClerkProvider.browser.tsx

Fixes #3042

Note

Keep desktop app rendering when Clerk UI bundle fails to load

Previously, DesktopClerkProvider returned null until the Clerk UI bundle fully loaded, blocking the app on load errors. Now it renders immediately, passing a useMemo-created thenable as the ui prop to InternalClerkProvider instead of waiting for the resolved constructor. Load errors are caught and logged but no longer prevent rendering.

Macroscope summarized f44f1a5.


Note

Medium Risk
Changes when desktop auth/UI mount relative to the remote Clerk UI bundle; core Clerk instance and fetch proxy are unchanged, but sign-in UI may stay unavailable if the script fails.

Overview
Desktop no longer blocks on the optional Clerk UI script. DesktopClerkProvider used to return null until loadDesktopClerkUi finished, so a slow or failed UI bundle from Clerk’s CDN prevented the router and rest of the app from mounting.

The provider now builds a thenable via useMemo and passes it to InternalClerkProvider’s ui.ClerkUI prop so Clerk can mount auth context immediately while the UI bundle loads in the background. Load failures are still surfaced with console.error in a useEffect catch, but children render either way.

Reviewed by Cursor Bugbot for commit f44f1a5. Bugbot is set up for automated code reviews on this repo. Configure here.

Co-authored-by: codex <codex@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4ff74844-2846-4e80-92ab-a8450a28feae

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/clerk-startup-fail-open

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jun 11, 2026
@juliusmarminge juliusmarminge marked this pull request as ready for review June 11, 2026 21:59
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

🚀 Expo continuous deployment is ready!

  • Project → t3-code
  • Platforms → android, ios
  • Scheme → t3code-preview
  🤖 Android 🍎 iOS
Fingerprint ae17d94b35f91f9c608a63dadbc3ddd9f4ba056e 313e506a7f15a9c3f15b01d787d68a12382432bf
Build Details Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: ae17d94b35f91f9c608a63dadbc3ddd9f4ba056e
App version: 0.1.0
Git commit: 8db1f1425d24480313ea2adbd338ab3643d25dea
Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: 313e506a7f15a9c3f15b01d787d68a12382432bf
App version: 0.1.0
Git commit: ca94cf47249b94c631e739200404bae250ad57e1
Update Details Update Permalink
DetailsBranch: pr-3049
Runtime version: ae17d94b35f91f9c608a63dadbc3ddd9f4ba056e
Git commit: ca94cf47249b94c631e739200404bae250ad57e1
Update Permalink
DetailsBranch: pr-3049
Runtime version: 313e506a7f15a9c3f15b01d787d68a12382432bf
Git commit: ca94cf47249b94c631e739200404bae250ad57e1
Update QR

@macroscopeapp

macroscopeapp Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR modifies authentication-related code (Clerk provider), changing behavior from blocking render on UI load failure to continuing with a promise-based approach. Auth changes warrant human review regardless of simplicity.

You can customize Macroscope's approvability policy. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Clerk connection clerk.t3.codes required to start the app

1 participant