Skip to content

Commit afffc8b

Browse files
committed
Merge branch 'main' of github.com:croutonn/graphql-codegen-plugin-typescript-swr into main
2 parents b2cd764 + 2a8b4f6 commit afffc8b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ import { GraphQLClient } from 'graphql-request'
2424
import { getSdkWithHooks } from './graphql'
2525

2626
const sdk = getSdkWithHooks(
27-
// Disable the cache because it is managed by `swr`.
28-
// In the case of SSG, the server side always fetches the latest data, so it is unnecessary.
29-
new GraphQLClient(`${process.env.API_URL}/graphql`, { cache: 'no-cache' })
27+
new GraphQLClient(`${process.env.API_URL}/graphql`, { cache: typeof window === 'object' ? 'default' : 'no-cache' })
3028
)
3129

3230
export default sdk

0 commit comments

Comments
 (0)