Skip to content

fix(clerk-js): static QueryClient import in native entry point#8170

Closed
jacekradko wants to merge 3 commits intochris/fix-query-client-rnfrom
jacek/fix-query-client-rn-static-import
Closed

fix(clerk-js): static QueryClient import in native entry point#8170
jacekradko wants to merge 3 commits intochris/fix-query-client-rnfrom
jacek/fix-query-client-rn-static-import

Conversation

@jacekradko
Copy link
Member

Summary

Alternative approach to fixing the React Native QueryClient issue (discussed in #8087):

  • Creates a dedicated native entry point (index.native.ts) that statically imports QueryClient and overrides the lazy getter on the Clerk prototype
  • Points the clerkNative rspack variant at this new entry point
  • Removes the Expo-side workaround (require('@tanstack/query-core') override in createClerkInstance.ts)
  • Removes @tanstack/query-core as a direct dependency of @clerk/expo

This fixes the root cause at the bundler level — only the native build's entry point is affected, leaving other dynamic imports (cookieSuffix, debug, etc.) untouched.

Test plan

  • Build passes (pnpm build)
  • Verify on iOS simulator with NativeComponentQuickstart app
  • useOrganizationList and other query-based hooks return real data on React Native

Move the synchronous QueryClient fix from the Expo package into
clerk-js itself by creating a dedicated native entry point
(index.native.ts) that statically imports QueryClient and overrides
the lazy getter on the Clerk prototype. This fixes the root cause
at the bundler level without affecting other dynamic imports.
@changeset-bot
Copy link

changeset-bot bot commented Mar 26, 2026

⚠️ No Changeset found

Latest commit: 0b63c1c

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 changesets to release 3 packages
Name Type
@clerk/clerk-js Patch
@clerk/chrome-extension Patch
@clerk/expo Patch

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

@vercel
Copy link

vercel bot commented Mar 26, 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 26, 2026 6:48pm

Request Review

…rity test

Eliminate duplicated exports in index.native.ts by using
'export * from ./index'. Add a test that verifies the native
entry point exports match the base entry point.
@jacekradko
Copy link
Member Author

Closing as this seems to be a more robust approach: #8087 (comment)

@jacekradko jacekradko closed this Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant