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

Add useSWRImmutable helper hook #60

Open
b1rdex opened this issue Feb 9, 2024 · 0 comments
Open

Add useSWRImmutable helper hook #60

b1rdex opened this issue Feb 9, 2024 · 0 comments

Comments

@b1rdex
Copy link

b1rdex commented Feb 9, 2024

Some resources are immutable (or app should not revalidate their contents).

For now, I have to use it like this:

const { data: itemInfoData } = client.users.list.useSWR(
  {some: "params"},
  {
    revalidateIfStale: false,
    revalidateOnFocus: false,
    revalidateOnReconnect: false,
  },
);

Using the original SWR this could be simplified to

const { data: itemInfoData } = client.users.list.useSWRImmutable({some: 'params'});

Please consider adding this simple helper hook.

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

No branches or pull requests

1 participant