Skip to content

Commit

Permalink
Add use client directive for client components exports (#2696)
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Jun 27, 2023
1 parent 024cbd1 commit f0d80d3
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 24 deletions.
2 changes: 2 additions & 0 deletions core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

// useSWR
import useSWR from './use-swr'
export default useSWR
Expand Down
2 changes: 2 additions & 0 deletions immutable/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import type { Middleware } from 'swr'
import useSWR from 'swr'
import { withMiddleware } from 'swr/_internal'
Expand Down
2 changes: 2 additions & 0 deletions infinite/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

// We have to several type castings here because `useSWRInfinite` is a special
// hook where `key` and return type are not like the normal `useSWR` types.

Expand Down
2 changes: 2 additions & 0 deletions mutation/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { useCallback, useRef } from 'react'
import useSWR, { useSWRConfig } from 'swr'
import type { Middleware, Key } from 'swr/_internal'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"@types/use-sync-external-store": "^0.0.3",
"@typescript-eslint/eslint-plugin": "5.59.8",
"@typescript-eslint/parser": "5.59.8",
"bunchee": "3.4.1",
"bunchee": "3.5.0",
"eslint": "8.42.0",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-jest-dom": "5.0.1",
Expand Down
29 changes: 6 additions & 23 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions subscription/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import type { Key, SWRHook, Middleware, SWRConfiguration, SWRConfig } from 'swr'
import type {
SWRSubscriptionOptions,
Expand Down

0 comments on commit f0d80d3

Please sign in to comment.