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

feat: fix types aligning with doc; and support null for mutate #274

Closed
wants to merge 1 commit into from

Conversation

LumaKernel
Copy link

@LumaKernel LumaKernel commented Mar 10, 2022

Doc says

If null, swrv will fetch from cache only and not revalidate.

But type doesn't accept null as fetcher. resolves #148

In addition, mutate (internally revalidate) does not treat null as special value differing to undefined. This changes runtime behavior a little. Now we can override mutate fetcher function with null even if initial fetcher function is not null. undefined stays as falling back to initial fetcher.

@CLAassistant
Copy link

CLAassistant commented Mar 10, 2022

CLA assistant check
All committers have signed the CLA.

config?: IConfig
): IResponse<Data, Error>
function useSWRV<Data = any, Error = any> (...args): IResponse<Data, Error> {
let key: IKey
let fn: fetcherFn<Data> | undefined
let fn: fetcherFn<Data> | undefined | null
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this is already fixed, can you 1. resolve conflicts, and 2. write a test?

@LumaKernel LumaKernel closed this Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Omitting fetcher function argument is ambiguous?
3 participants