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

useSWRList #2006

Closed
wants to merge 2 commits into from
Closed

useSWRList #2006

wants to merge 2 commits into from

Conversation

promer94
Copy link
Collaborator

@promer94 promer94 commented Jun 1, 2022

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 1, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit eebffca:

Sandbox Source
SWR-Basic Configuration
SWR-States Configuration
SWR-Infinite Configuration
SWR-SSR Configuration
useSWRList PR

@promer94
Copy link
Collaborator Author

promer94 commented Jun 2, 2022

This pr intends to support both proposals metioned in RFC.

Proposal A: "Array of SWRs"

API

const { result } = useSWRList(keys, fetcher, config)
interface Result {
    data: any;
    error: any;
    mutate: KeyedMutator<any>;
    isValidating: boolean;
    isLoading: boolean;
    key: string;
    originKey: Arguments;
}

Proposal B: Aggregated Return

API

const { data, isLoading, isValidating, mutate } = useSWRList(keys, fetcher, config)
type Data = {
    data?: any;
    error?: any;
    key: string;
    originKey: Arguments;
}[]

@promer94 promer94 changed the title WIP: useSWRList useSWRList Jun 17, 2022
@promer94 promer94 closed this Jun 17, 2022
@promer94 promer94 deleted the list branch March 5, 2023 08:55
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.

None yet

1 participant