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

fix(shared, nextjs): Support importing @clerk/shared in @clerk/nextjs #1767

Merged
merged 9 commits into from
Sep 28, 2023

Conversation

dimkl
Copy link
Contributor

@dimkl dimkl commented Sep 22, 2023

Description

Review it per commit

Use use client directive in @clerk/shared to support importing it in libraries compatible with RSC and use package in @clerk/nextjs (also replaced current copy/pasted code).

Checklist

  • npm test runs as expected.
  • npm run 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:

Packages affected

  • @clerk/clerk-js
  • @clerk/clerk-react
  • @clerk/nextjs
  • @clerk/remix
  • @clerk/types
  • @clerk/themes
  • @clerk/localizations
  • @clerk/clerk-expo
  • @clerk/backend
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/fastify
  • @clerk/chrome-extension
  • gatsby-plugin-clerk
  • build/tooling/chore

@dimkl dimkl requested a review from a team as a code owner September 22, 2023 10:50
@dimkl dimkl self-assigned this Sep 22, 2023
@changeset-bot
Copy link

changeset-bot bot commented Sep 22, 2023

🦋 Changeset detected

Latest commit: 921892f

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

This PR includes changesets to release 9 packages
Name Type
@clerk/nextjs Minor
@clerk/shared Minor
@clerk/clerk-js Patch
@clerk/fastify Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch
gatsby-plugin-clerk 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
Member

@panteliselef panteliselef left a comment

Choose a reason for hiding this comment

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

Do wee need to test this with snapshots ? Or should we be good as long this builds ? I remember someone mentioned a runtime error that is why i am asking.

packages/nextjs/src/server/utils.ts Show resolved Hide resolved
@panteliselef
Copy link
Member

Sorry didn't mean to approve, just to add a comment.

@dimkl
Copy link
Contributor Author

dimkl commented Sep 22, 2023

@panteliselef do know mean this runtime error ?: #1760 (comment)

@panteliselef
Copy link
Member

@panteliselef do know mean this runtime error ?: #1760 (comment)

yes, that one

@dimkl dimkl force-pushed the fix-shared-deps-in-nextjs branch 2 times, most recently from b9df973 to 39a24a0 Compare September 28, 2023 08:27
This change will resolve the following issue we had when importing
@clerk/shared in @clerk/nextjs:
```
Your're importing a component that needs useState. It only works in
a Client Component none of its parents are marked with "use client",
so they're Server Components by default.

[javascript/packages/shared/src/hooks/usePagesOrInfinite.js:1:1]
import { useCallback, useMemo, useRef, useState } from "react";
```
@dimkl dimkl added this pull request to the merge queue Sep 28, 2023
Merged via the queue into main with commit 2d7d90c Sep 28, 2023
5 checks passed
@dimkl dimkl deleted the fix-shared-deps-in-nextjs branch September 28, 2023 12:08
@clerk-cookie clerk-cookie mentioned this pull request Sep 28, 2023
This was referenced Oct 5, 2023
@clerk-cookie
Copy link
Collaborator

This PR has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@clerk clerk locked as resolved and limited conversation to collaborators Sep 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants