Skip to content

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

Merged
dimkl merged 9 commits into
mainfrom
fix-shared-deps-in-nextjs
Sep 28, 2023
Merged

fix(shared, nextjs): Support importing @clerk/shared in @clerk/nextjs#1767
dimkl merged 9 commits into
mainfrom
fix-shared-deps-in-nextjs

Conversation

@dimkl

@dimkl dimkl commented Sep 22, 2023

Copy link
Copy Markdown
Contributor

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

changeset-bot Bot commented Sep 22, 2023

Copy link
Copy Markdown

🦋 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

@panteliselef panteliselef left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread packages/nextjs/src/server/utils.ts
@panteliselef

Copy link
Copy Markdown
Contributor

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

@dimkl

dimkl commented Sep 22, 2023

Copy link
Copy Markdown
Contributor Author

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

@panteliselef

Copy link
Copy Markdown
Contributor

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

yes, that one

Comment thread .changeset/unlucky-emus-greet.md Outdated
@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 force-pushed the fix-shared-deps-in-nextjs branch from 39a24a0 to 5864bc7 Compare September 28, 2023 10:31
@dimkl
dimkl enabled auto-merge September 28, 2023 11:52
@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
@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
Copy Markdown
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