Skip to content

Commit

Permalink
Revert "Feature: make return state(data, error and isValidating) read…
Browse files Browse the repository at this point in the history
…only" (#1443)

* Revert "make return state(data, error and isValidating) readonly (#1431)"

This reverts commit ec778e7.

* enable diagnostics on CI
  • Loading branch information
huozhi committed Sep 9, 2021
1 parent 25a3904 commit e789a4d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
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

0 comments on commit e789a4d

Please sign in to comment.