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

Revert "Feature: make return state(data, error and isValidating) readonly" #1443

Merged
merged 2 commits into from
Sep 9, 2021
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
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
globals: {
'ts-jest': {
tsconfig: 'test/tsconfig.json',
diagnostics: false,
diagnostics: process.env.CI,
}
},
}
6 changes: 3 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ export type SWRConfiguration<
export type Key = ValueKey | (() => ValueKey)

export interface SWRResponse<Data, Error> {
data?: Readonly<Data>
error?: Readonly<Error>
data?: Data
error?: Error
mutate: KeyedMutator<Data>
isValidating: Readonly<boolean>
isValidating: boolean
}

export type KeyLoader<Data = any> =
Expand Down
5 changes: 1 addition & 4 deletions test/use-swr-immutable.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,7 @@ describe('useSWR - immutable', () => {
})

it('should not revalidate with revalidateIfStale disabled when key changes', async () => {
const fetcher = jest.fn(v => {
console.log(v)
return v
})
const fetcher = jest.fn(v => v)

const key = createKey()
const useData = (id: string) =>
Expand Down