Skip to content

refactor(react): unify headless init with replayInterceptedInvocations#8011

Merged
chriscanin merged 1 commit into
chris/mobile-405-react-native-components-releasefrom
chris/unify-headless-init
Mar 9, 2026
Merged

refactor(react): unify headless init with replayInterceptedInvocations#8011
chriscanin merged 1 commit into
chris/mobile-405-react-native-components-releasefrom
chris/unify-headless-init

Conversation

@chriscanin
Copy link
Copy Markdown
Contributor

Summary

  • Removes the duplicate finishInit() from loadHeadlessClerk and uses the shared replayInterceptedInvocations path instead
  • Eliminates the manual state emission workaround that was only needed because the headless path had its own initialization logic
  • Removes the now-unused #initialized field

This addresses @brkalow's feedback to separate "how to get a Clerk instance" (bring your own constructor vs inject scripts) from "what to do after it's loaded" (shared wiring logic).

Before: loadHeadlessClerk had its own finishInit() that duplicated parts of replayInterceptedInvocations but was missing status/queryClientStatus listener replay.

After: loadHeadlessClerk only handles Clerk construction + clerk.load(), then hands off to the shared replayInterceptedInvocations path — same as the browser flow.

Test plan

  • Verify Expo native sign-in/sign-up flows still work (headless path)
  • Verify Next.js/React browser flows are unaffected (getEntryChunks path)
  • Verify chrome-extension with syncHost still works (getEntryChunks path)

…ocations

Remove the duplicate finishInit() from loadHeadlessClerk and use the
shared replayInterceptedInvocations path instead. This ensures both
browser and headless paths share the same post-load wiring logic,
including status/queryClientStatus listener replay that was previously
missing from the headless path.

The manual state emission workaround in finishInit is no longer needed
since replayInterceptedInvocations properly wires up addListener which
handles state propagation through clerk-js.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 9, 2026

⚠️ No Changeset found

Latest commit: 034dd71

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

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

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added the react label Mar 9, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 9, 2026

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

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Mar 9, 2026 2:28pm

Request Review

Copy link
Copy Markdown
Member

@brkalow brkalow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great

@chriscanin chriscanin merged commit 825d79f into chris/mobile-405-react-native-components-release Mar 9, 2026
7 checks passed
@chriscanin chriscanin deleted the chris/unify-headless-init branch March 9, 2026 14:38
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.

2 participants