Skip to content

refactor(expo-native-components): remove legacy client sync bridge - #9958

Draft
mikepitre wants to merge 1 commit into
mike/expo-native-sync-enginefrom
mike/expo-native-remove-legacy-sync
Draft

mikepitre wants to merge 1 commit into
mike/expo-native-sync-enginefrom
mike/expo-native-remove-legacy-sync

Conversation

@mikepitre

@mikepitre mikepitre commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

Stacked on #9956 (stack: main ← #9955 ← #9957 ← #9954 ← #9956 ← this PR). #9956 moved @clerk/expo to the new client sync engine, which only uses configureNative, getDeviceToken, setDeviceToken, refreshClient and the clerkNativeClientInvalidated event from #9957. This PR removes the legacy native sync path from @clerk/expo-native-components that nothing calls any more.

Removed on iOS (ClerkExpoModule.swift, ClerkNativeBridge.swift) and Android (ClerkExpoModule.kt):

  • configure(publishableKey, bearerToken), getClientToken() and syncClientStateFromJs(...).
  • The clerkNativeClientChanged event, with its emitter and payload builder, and the Android companion emitClientChanged.
  • The client observation loop that fed that event: lastObservedClientState, jsOriginatedClientSyncDepth and the client-state snapshot/changes types. On iOS this also removes clientObservationGeneration, syncTokenState and waitForLoadedClient. On Android it removes clientStateObserverJob, emitSyncedClientChanged and the unused sharedInstance. configureNative no longer starts that loop.

Unchanged: auth-flow state and clerkNativeAuthFlowChanged, getAuthFlowState, pending callback URL handling, client invalidation, and the trusted-device / biometric reverification functions. The shared iOS event queue stays because the auth-flow and invalidation emitters still use it.

Native views:

  • iOS: ClerkNativeViewHost attaches its controller once ClerkNativeBridge is configured, and retries on the clerkNativeSDKDidConfigure notification. configureNative already posts that notification when it configures or reconfigures the SDK, so views mounted before configuration still attach. The legacy configure posted it only after waiting (up to 3s) for Clerk.shared.isLoaded. configureNative posts it as soon as ClerkKit is configured, as it already did in feat(expo): simplify native client sync engine #9956. The hosted SwiftUI views observe Clerk.shared, so they update when the client loads.
  • Android: no view depended on configure awaiting initialization. ClerkAuthViewModule recreates AuthView when Clerk.isInitialized flips, and the UserButton/UserProfile views collect Clerk.userFlow. Only a comment that referred to configure() changed.

No TypeScript types for the legacy methods were left in @clerk/expo or @clerk/expo-native-components. One test mock in @clerk/expo now uses configureNative instead of configure. @clerk/expo-native-components is unreleased, so this uses an empty changeset.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

🤖 Generated with Claude Code

@vercel

vercel Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Sep 28, 2026 8:26pm UTC
swingset Ready Ready Preview Sep 28, 2026 8:26pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5a9f6ab

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@coderabbitai

coderabbitai Bot commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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

Remove configure, getClientToken, syncClientStateFromJs and the
clerkNativeClientChanged event from the iOS and Android ClerkExpo module,
along with the client observation loop and JS-sync suppression state that
only served them. The JS engine now uses configureNative, getDeviceToken,
setDeviceToken, refreshClient and clerkNativeClientInvalidated.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@mikepitre
mikepitre force-pushed the mike/expo-native-sync-engine branch from ec9a54c to 1b59ac3 Compare September 28, 2026 20:23
@mikepitre
mikepitre force-pushed the mike/expo-native-remove-legacy-sync branch from 871298f to 5a9f6ab Compare September 28, 2026 20:23
@mikepitre mikepitre changed the title refactor(expo-native): remove legacy client sync bridge refactor(expo-native-components): remove legacy client sync bridge Sep 28, 2026

This branch was successfully deployed

2 active deployments
Preview – swingset — 5a9f6abf Deployed Sep 28, 2026 by vercel[bot]
Preview – clerk-js-sandbox — 5a9f6abf Deployed Sep 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant