Skip to content
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

feat: Add react-router SDK #4621

Merged
merged 53 commits into from
Dec 9, 2024
Merged

Conversation

LekoArts
Copy link
Member

@LekoArts LekoArts commented Nov 21, 2024

Description

Add @clerk/react-router package to support React Router v7 (https://remix.run/blog/react-router-v7).

Fixes #4641

Architecture

Fundamentally the package was copied from @clerk/remix and then the migration steps were done. I've also switched from the HoC pattern ClerkApp(App) to having the user put our <ClerkProvider> into their app. This gives us more flexibility (and access to loaderData) + it seems to be better for dealing with lazy loading with Suspense in Next.js (so maybe helps here, too).

How to use:

See Docs PR: clerk/clerk-docs#1760

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Copy link

changeset-bot bot commented Nov 21, 2024

🦋 Changeset detected

Latest commit: 12ddee6

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

This PR includes changesets to release 1 package
Name Type
@clerk/react-router 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

Copy link

vercel bot commented Nov 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 9, 2024 3:59pm

@LekoArts
Copy link
Member Author

!snapshot

@clerk-cookie

This comment was marked as outdated.

@LekoArts
Copy link
Member Author

!snapshot

@clerk-cookie

This comment was marked as outdated.

Copy link
Member Author

@LekoArts LekoArts left a comment

Choose a reason for hiding this comment

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

Self-review with some TODO comments what I'll still tackle

@@ -28,4 +28,4 @@ jobs:
- name: Validate Renovate Config
env:
RENOVATE_VERSION: 37.440.7 # Last version compatible with Node 18
run: pnpm dlx renovate@${{ env.RENOVATE_VERSION }} renovate-config-validator
run: npx --yes --package renovate@${{ env.RENOVATE_VERSION }} renovate-config-validator
Copy link
Member Author

Choose a reason for hiding this comment

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

The previous version didn't work so I just reverted the pnpm change here

packages/react-router/package.json Show resolved Hide resolved
Omit<ReactRouterClerkProviderProps, 'routerPush' | 'routerReplace' | 'clerkState'>
>;

// TODO: Remove "any" on loaderData type
Copy link
Member Author

Choose a reason for hiding this comment

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

With some TS magic I think we can achieve that the Route.LoaderArgs is passed through to our component, right?

packages/react-router/src/utils/errors.ts Outdated Show resolved Hide resolved
packages/react-router/src/utils/errors.ts Outdated Show resolved Hide resolved
packages/react-router/src/utils/errors.ts Show resolved Hide resolved
playground/react-router-node/README.md Outdated Show resolved Hide resolved
@LekoArts LekoArts marked this pull request as ready for review December 4, 2024 15:56
@@ -634,6 +634,65 @@
],
"semanticCommitScope": "eslint-config-custom"
},
{
Copy link
Member

Choose a reason for hiding this comment

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

Are these changes related to the react-router SDK introduction ?

Copy link
Member Author

Choose a reason for hiding this comment

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

The previous PRs adding these new packages forgot to update our renovate configuration, so when I did that now for react-router it added those missing ones. If I'd only add react-router our (non-blocking) CI check for Renovate would fail so I figured I just add the missing ones as I have to touch that file anyways.

Copy link
Member

@tmilewski tmilewski left a comment

Choose a reason for hiding this comment

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

One minor comment around function naming & consistency.

packages/react-router/src/utils/utils.ts Outdated Show resolved Hide resolved
Copy link
Member

@wobsoriano wobsoriano left a comment

Choose a reason for hiding this comment

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

It looks good 🫡

@phuctm97
Copy link

phuctm97 commented Dec 8, 2024

Any expected timeline for when this will be merged?

@LekoArts
Copy link
Member Author

LekoArts commented Dec 9, 2024

@phuctm97 You can expect this to be released this week

Copy link
Member

@anagstef anagstef left a comment

Choose a reason for hiding this comment

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

🔥 🚀

@LekoArts LekoArts merged commit 3e1edf8 into main Dec 9, 2024
28 checks passed
@LekoArts LekoArts deleted the lekoarts/eco-247-bootstrap-new-package branch December 9, 2024 16:04
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.

react-router v7 compatibility
7 participants