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

remove the 'use client' directive and add client-only to useSWR entry. #2705

Merged
merged 3 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"clean": "rimraf dist"
},
"peerDependencies": {
"client-only": "*",
"swr": "*",
"react": "*",
"use-sync-external-store": "*"
Expand Down
1 change: 1 addition & 0 deletions core/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'client-only'
2 changes: 1 addition & 1 deletion core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use client'
import 'client-only'

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

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

import { useCallback, useRef } from 'react'
import useSWR, { useSWRConfig } from 'swr'
import type { Middleware, Key } from 'swr/_internal'
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
"trailingComma": "none"
},
"dependencies": {
"client-only": "^0.0.1",
"use-sync-external-store": "^1.2.0"
}
}
4 changes: 3 additions & 1 deletion pnpm-lock.yaml

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

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

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