-   Notifications  
You must be signed in to change notification settings  - Fork 402
 
 fix(react-router): Simplify types for LoaderFunctionArgs #6019 
 New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
  fix(react-router): Simplify types for LoaderFunctionArgs  #6019 
 Conversation
 🦋 Changeset detectedLatest commit: 0aeaa5c 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 Git ↗︎ 
  |  
…uthloader-callback-function-not
|   !allow-major  |  
…uthloader-callback-function-not
  @clerk/agent-toolkit
 @clerk/astro
 @clerk/backend
 @clerk/chrome-extension
 @clerk/clerk-js
 @clerk/dev-cli
 @clerk/elements
 @clerk/clerk-expo
 @clerk/expo-passkeys
 @clerk/express
 @clerk/fastify
 @clerk/localizations
 @clerk/nextjs
 @clerk/nuxt
 @clerk/clerk-react
 @clerk/react-router
 @clerk/remix
 @clerk/shared
 @clerk/tanstack-react-start
 @clerk/testing
 @clerk/themes
 @clerk/types
 @clerk/upgrade
 @clerk/vue
 commit:   |  
LoaderFunctionArgs | // TODO: Remove "any" on loaderData type and use Route.ComponentProps from userland code | ||
| type ClerkProviderProps = ClerkReactRouterOptions & { | ||
| loaderData?: ReactRouterComponentProps['loaderData']; | ||
| loaderData?: any; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was already resolving to any previously, so we can remove the reliance on react-router/route-module here
Description
React Router made an internal breaking change in 7.6.1: https://github.com/remix-run/react-router/blob/main/CHANGELOG.md#v761
We were relying on
react-router/route-moduleto give type annotations forrootAuthLoader.In this PR we're moving away from using unstable internal APIs and instead use the publicly available
LoaderFunction/LoaderFunctionArgsfor ourrootAuthLoader()andgetAuth()types.Previously we were trying to get this type: https://github.com/remix-run/react-router/blob/c06ec85cf05e0ec5a3f399160ae3512206fac980/packages/react-router/lib/types/route-module-annotations.ts#L103-L136
But we can also use https://github.com/remix-run/react-router/blob/c06ec85cf05e0ec5a3f399160ae3512206fac980/packages/react-router/lib/router/utils.ts#L185-L209 because it's the same shape.
Fixes #6012
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change