Conversation
🦋 Changeset detectedLatest commit: 1b59ac3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
544222b to
8c5d287
Compare
57d6357 to
5fa1eaf
Compare
|
Superseded by #9956 (comment) (re-recorded so sheet and modal animations are captured). |
8c5d287 to
44460ec
Compare
5fa1eaf to
ec9a54c
Compare
Replace the JS <-> native client sync engine with one where native storage owns the single shared device token and each side refetches its own client on a payload-free "client changed" signal. Codes against the new ClerkExpo module contract (configureNative, getDeviceToken, setDeviceToken CAS, refreshClient, clerkNativeClientInvalidated). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Session updatedAt can move on session activity and token refresh, which would refresh the native client on every token refresh. Profile edits still reach native through the active user's updatedAt. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
44460ec to
9e19e6d
Compare
ec9a54c to
1b59ac3
Compare
|
Superseded by #9956 (comment) (re-recorded from a plain create-expo-app app with no native workarounds). |
|
Native ↔ JS sync round trip from a plain app: a fresh
roundtrip-final.mp4 |
Description
Replaces the
@clerk/expoJS <-> native client sync engine (nativeClientSync.tsx,nativeClientSyncCoordinator.ts,useNativeClientEvents) with a much smaller one inprovider/nativeClientSync.ts. Stacked on #9954, whose behavior suite now runs against this engine.The server is the source of truth. The two SDKs share only:
getDeviceToken(), and a rotated token from a response is written withsetDeviceToken(token, requestToken), a compare-and-set against the token that request was sent with (recorded per request increateClerkInstance). The effective token is mirrored into the app'stokenCacheso it stays usable without native.refreshClient(); when native emitsclerkNativeClientInvalidated, JS refetches its own client and follows native's active session. Both directions are single-flight with one trailing rerun, and a native pull records the fingerprint it applied so it is not echoed back.No state is pushed across the bridge, and the source-id tags, suppression counters, generation counters and token rollback are gone.
configureNativeis local setup only and runs once per publishable key before clerk-js's first request; native keeps its own stored token and only adopts the seed fromtokenCachewhen it has none. If it fails or takes longer than 3s, sync stays off for the session and clerk-js keeps usingtokenCachedirectly, which is also what happens without the native module or with__experimental_disableNativeClientSync.Other pieces:
handleUnauthenticatedguard refetches the client first and only signs out when no signed-in session remains. TheupdateClientinterception still hides clerk-js's transient signed-out emission while another session is activated.idle()andpullFromNative()barriers.idle()rejects with the latest native refresh failure until a later refresh succeeds, and withenvironment_unavailableafter 5s.configureNativekeeping native's own token.New
ClerkExpocontract:configureNative(publishableKey, seedDeviceToken),getDeviceToken(),setDeviceToken(token, expected): Promise<boolean>,refreshClient(), and theclerkNativeClientInvalidatedevent. This PR is JS only. It depends on the native bridge PR (link to follow), which is backed by clerk/clerk-ios#583 and clerk/clerk-android#964.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
🤖 Generated with Claude Code