fix(expo): synchronous QueryClient for React Native#8087
fix(expo): synchronous QueryClient for React Native#8087chriscanin wants to merge 1 commit intomainfrom
Conversation
…lity
clerk-js uses rspack code-splitting to lazily load QueryClient via
dynamic import('./query-core'). On React Native, Metro bundles everything
into a single file, so rspack's chunk loading never resolves and
__internal_queryClient stays undefined.
The useClerkQueryClient hook falls back to a no-op mock proxy when the
query client is undefined, causing hooks like useOrganizationList,
useSessionList, etc. to silently return empty data.
Fix: use Object.defineProperty to override the broken getter on the Clerk
instance with a synchronous version that creates a QueryClient via
require('@tanstack/query-core') on first access.
🦋 Changeset detectedLatest commit: 8cc330d 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.
|
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis pull request adds a changeset entry documenting a patch release and includes a runtime workaround for React Native environments. The change addresses an issue where query-based hooks, such as useOrganizationList, were returning empty data. The fix involves synchronously creating and providing a TanStack QueryClient instance in the Clerk instance initialization. Specifically, a lazy-initialized getter is added to ensure the QueryClient is available on first access, working around code-splitting and chunk loading issues that previously left the QueryClient undefined. 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can use your project's `biome` configuration to improve the quality of JS/TS/CSS/JSON code reviews.Add a configuration file to your project to customize how CodeRabbit runs |
Summary
clerk-jslazily loadsQueryClientfrom@tanstack/query-corevia rspack's dynamicimport('./query-core')code-splittingl.e("675")) never resolves, soclerk.__internal_queryClientstaysundefineduseClerkQueryClienthook falls back to a no-op mock proxy when undefined, causinguseOrganizationList,useSessionList, and other query-based hooks to silently return empty dataObject.definePropertyoverride increateClerkInstance.tsthat synchronously creates aQueryClientviarequire('@tanstack/query-core')on first access, returning the expected{ __tag: 'clerk-rq-client', client }shapeReported by
Donovan (internal) —
useOrganizationListreturns empty data on React NativeTest plan
@clerk/expobuilds successfully with the changeuseOrganizationListreturns data on React Native after fixuseSessionList, etc.) work correctly🤖 Generated with Claude Code
Summary by CodeRabbit
useOrganizationListand other query-based hooks returning empty data on React Native environments. Ensured proper initialization of internal query client for Expo applications.