Skip to content

Commit

Permalink
fix(shared): Fix error improrting @clerk/shared in RSC SDK (eg @clerk…
Browse files Browse the repository at this point in the history
…/nextjs)

node_modules/@clerk/shared/dist/cjs/hooks/createContextAndHook.js (43:35)
 @ createContext
createContext only works in Client Components. Add the "use client"
 directive at the top of the file to use it. Read more:
 https://nextjs.org/docs/messages/context-in-server-component
    at createContextAndHook (webpack-internal:///(rsc)/./node_modules/
     @clerk/shared/dist/cjs/hooks/createContextAndHook.js:48:38)
    at eval (webpack-internal:///(rsc)/./node_modules/@clerk/shared/
     dist/cjs/hooks/contexts.js:53:110)
  • Loading branch information
dimkl committed Sep 29, 2023
1 parent 1dcc624 commit 1cdbcfc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/shared/src/hooks/contexts.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import type {
ActiveSessionResource,
ClientResource,
Expand Down
1 change: 1 addition & 0 deletions packages/shared/src/hooks/createContextAndHook.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
import React from 'react';

export function assertContextExists(contextVal: unknown, msgOrCtx: string | React.Context<any>): asserts contextVal {
Expand Down

0 comments on commit 1cdbcfc

Please sign in to comment.