Skip to content

fix(expo): deduplicate native client startup requests#9140

Draft
mikepitre wants to merge 1 commit into
mainfrom
mike/fix-expo-startup-requests
Draft

fix(expo): deduplicate native client startup requests#9140
mikepitre wants to merge 1 commit into
mainfrom
mike/fix-expo-startup-requests

Conversation

@mikepitre

Copy link
Copy Markdown
Contributor

Expo native-client startup could trigger repeated client refreshes across the JS and native runtimes. In the captured SDK 56 launch, that produced 11 Clerk requests, including eight identical GET /v1/client calls.

The duplicate requests came from native configuration racing JS client hydration, observer callbacks echoing bootstrap and JS-originated changes, and device-token updates being followed by a second explicit refresh. This change waits for the JS Clerk instance before reading its initial token, configures native once with that token, and reconciles the two clients after both sides are ready. Native observers now seed their initial snapshot and suppress bootstrap or JS-originated echoes without dropping later native changes.

Token-cache notifications are deduplicated, client changes that occur before native is ready are coalesced, and configure failures still release the synchronization barrier. Focused tests cover initial bootstrap, token rotation, remount recovery, configure failure, and native-to-JS reconciliation.

With the SDK 56 hosted-auth example unchanged, process-cold launches on iOS and Android each produce four Clerk requests: one JS and one native request for /v1/environment, plus one JS and one native request for /v1/client.

@changeset-bot

changeset-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 245258e

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

This PR includes changesets to release 1 package
Name Type
@clerk/expo Patch

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

@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jul 11, 2026 12:31pm
swingset Ready Ready Preview, Comment Jul 11, 2026 12:31pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

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 YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 08a62be1-3252-4729-9c6c-68c1edaac435

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

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

@pkg-pr-new

pkg-pr-new Bot commented Jul 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@9140

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@9140

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@9140

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@9140

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@9140

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@9140

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@9140

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@9140

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@9140

@clerk/express

npm i https://pkg.pr.new/@clerk/express@9140

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@9140

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@9140

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@9140

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@9140

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@9140

@clerk/react

npm i https://pkg.pr.new/@clerk/react@9140

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@9140

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@9140

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@9140

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@9140

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@9140

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@9140

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@9140

commit: 245258e

@mikepitre mikepitre changed the title [codex] fix(expo): deduplicate native client startup requests fix(expo): deduplicate native client startup requests Jul 11, 2026
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