You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(mobile): T3 Connect sign-in recovers after launching offline - #41712
If the mobile app starts while the device has no network (Android often restarts a killed app as you return to it, sometimes before Wi‑Fi reconnects), Clerk's first load fails and never retries. The T3 Connect sign-in stays empty, so every environment — including ones on a LAN route — sits on "This device is still loading its T3 Connect sign-in" and keeps retrying until the app is force-quit.
Reproduce on Android: force-stop the app, turn on airplane mode, open the app, wait ~10 s, turn airplane mode off. Expected: the sign-in loads and environments reconnect. Actual: stuck until force-quit. Seen on the Android internal build 2.3.0-816; the steps above reproduce it on that build.
This is the mobile side of #37602. #37621 fixes the web client by reloading the page; that does not apply to mobile.
Change
Turn on @clerk/expo's resource cache. Without it, clerk-js (6.42.3) treats a failed native launch load as fatal and nothing retries it. With it, Clerk loads the cached client offline and retries the network fetch with backoff. It is passed in both places it matters: getClerkInstance (the singleton is created there, and Clerk only reads the cache when it creates the singleton) and <ClerkProvider> (which only reports offline failures as network_error, the code the fallback needs, when the cache is set).
The cloud account service already ignores signed-out emissions from Clerk's client_init placeholder until Clerk's API confirms a sign-out. An empty resource cache loads a different placeholder, client_DUMMY_ID, with no user. Without treating it the same way, a signed-in user's first offline launch on this build would count as a sign-out and remove their T3 Connect environments. Clerk does not export its isDummyClient check, so the id is matched next to client_init.
Scope
Bug fix. Linked issue: #37602 (same symptom and cause, reported for desktop).
Verification
On an Android emulator (Pixel 9, API 37) with the dev client and production T3 Connect config, signed out. The "T3 Account" row in Settings shows "Checking" until Clerk has loaded, so it shows whether the load recovered.
Before: airplane mode on, launch, airplane mode off. The row stayed on "Checking" for the 90 s I watched after the network came back.
After, with app data cleared (empty cache): offline, Clerk loaded the placeholder client and the row showed "Sign in". About 10 s after the network returned, Clerk fetched the real client (temporary logging showed the id change from client_DUMMY_ID to a real client_… id) with no restart, and the sign-in screen opened.
cloudAccountService.test.ts: the new client_DUMMY_ID case fails on main and passes with this change. vp run check:changed passes.
Before (90 s after reconnecting)
After (back online, no restart)
Not checked: the signed-in path end to end, meaning an offline launch while signed in that then reconnects a T3 Connect environment once the network returns. I only tested signed out, so that path is inferred from Clerk's code, not observed.
Reviewing files that changed from the base of the PR and between 6bfe0fb and 121ba4a.
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
No actionable comments were generated in the recent review.
Walkthrough
The mobile Clerk provider and service singleton now receive the same resource cache. The cloud account service ignores client_DUMMY_ID as a placeholder, and the offline-launch test covers this observation.
Changes: Mobile Clerk resource-cache handling
Layer / File(s)
Summary
Pass the resource cache to Clerk apps/mobile/src/features/cloud/CloudAuthProvider.tsx
The service singleton and rendered ClerkProvider receive Clerk’s resourceCache.
Ignore the Expo placeholder client packages/client-runtime/src/relay/cloudAccountService.ts, packages/client-runtime/src/relay/cloudAccountService.test.ts
The service rejects client_DUMMY_ID as a placeholder. The offline-launch test verifies that this observation leaves the service unobserved and produces no log entries.
pingdotgg/t3code#24306 — The issue reports a mobile account row stuck on “Checking” during launch. This change addresses an offline-launch placeholder observation, though the issue’s trigger is unknown.
Possibly related PRs
pingdotgg/t3code#25150 — Adds the mobile adapter and attaches the cloud account service to the native Clerk singleton used by this change.
pingdotgg/t3code#24974 — Adds the shared cloud account service and tests that this change updates.
Suggested reviewers:juliusmarminge, macroscopeapp
Merge Risk: Minimal · previous review 6bfe0
This change lets mobile T3 Connect sign-in recover after the app launches offline, and it stops the Clerk placeholder client from being treated as a sign-out. No concrete merge-blocking risk was established. The signed-in offline-launch and reconnection path was not tested and is worth a manual check if convenient.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: a mobile fix so T3 Connect sign-in recovers after the app launches offline. The changeset enables Clerk's resource cache and treats the client_DUMMY_ID placeholder as …
Description check
The description follows the template sections: Problem, Change, Scope, and Verification. The Problem section gives the symptom, reproduction steps, and expected and actual behavior. The Change section…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: a mobile fix so T3 Connect sign-in recovers after the app launches offline. The changeset enables Clerk's resource cache and treats the client_DUMMY_ID placeholder as an id-less client, which matches the title. It is a conventional commit title in plain language.
Full details: Description check
Explanation
The description follows the template sections: Problem, Change, Scope, and Verification. The Problem section gives the symptom, reproduction steps, and expected and actual behavior. The Change section explains both the resource cache and the client_DUMMY_ID handling, and why each is needed. Scope links issue #37602 and calls the work a bug fix. Verification gives focused test results and before/after evidence, and it states what was not checked. The author also names the model and harness used, as the template asks. Minor gap: the Scope section does not say why the change needs no issue, but a linked issue is provided, so this is not required.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Fix failing CI checks
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:S10-29 changed lines (additions + deletions).vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
If the mobile app starts while the device has no network (Android often restarts a killed app as you return to it, sometimes before Wi‑Fi reconnects), Clerk's first load fails and never retries. The T3 Connect sign-in stays empty, so every environment — including ones on a LAN route — sits on "This device is still loading its T3 Connect sign-in" and keeps retrying until the app is force-quit.
Reproduce on Android: force-stop the app, turn on airplane mode, open the app, wait ~10 s, turn airplane mode off. Expected: the sign-in loads and environments reconnect. Actual: stuck until force-quit. Seen on the Android internal build
2.3.0-816; the steps above reproduce it on that build.This is the mobile side of #37602. #37621 fixes the web client by reloading the page; that does not apply to mobile.
Change
@clerk/expo's resource cache. Without it,clerk-js(6.42.3) treats a failed native launch load as fatal and nothing retries it. With it, Clerk loads the cached client offline and retries the network fetch with backoff. It is passed in both places it matters:getClerkInstance(the singleton is created there, and Clerk only reads the cache when it creates the singleton) and<ClerkProvider>(which only reports offline failures asnetwork_error, the code the fallback needs, when the cache is set).client_initplaceholder until Clerk's API confirms a sign-out. An empty resource cache loads a different placeholder,client_DUMMY_ID, with no user. Without treating it the same way, a signed-in user's first offline launch on this build would count as a sign-out and remove their T3 Connect environments. Clerk does not export itsisDummyClientcheck, so the id is matched next toclient_init.Scope
Bug fix. Linked issue: #37602 (same symptom and cause, reported for desktop).
Verification
On an Android emulator (Pixel 9, API 37) with the dev client and production T3 Connect config, signed out. The "T3 Account" row in Settings shows "Checking" until Clerk has loaded, so it shows whether the load recovered.
client_DUMMY_IDto a realclient_…id) with no restart, and the sign-in screen opened.cloudAccountService.test.ts: the newclient_DUMMY_IDcase fails onmainand passes with this change.vp run check:changedpasses.Not checked: the signed-in path end to end, meaning an offline launch while signed in that then reconnects a T3 Connect environment once the network returns. I only tested signed out, so that path is inferred from Clerk's code, not observed.
Claude Opus 5.5 in Claude Code (T3 Code)