Replies: 1 comment 1 reply
-
In this case, the key of the const usePost = (profile_id, from_id = '') => {
const PAGE_LIMIT = 5;
let { data, size, setSize, error, mutate, isValidating } = useSWRInfinite(
(pageIndex, previousPageData) => {
const currentPageIndex = pageIndex + 1;
return [currentPageIndex, profile_id];
},
([currentPageIndex, profile_id]) => {
return fetcher(`/posts/profile/${profile_id}?page=${currentPageIndex}&from_id=${from_id}`)
},
{
revalidateFirstPage: false,
},
);
// more code
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have issue when using useSWR/useSWRInfinite hook to fetch data. Specifically, there are 3 variables in key of swr hook that I get and it changes whenever.
For example:
How can I prevent useSWRInfinite/useSWR revalidating even if from_id changes (excludes profile_id and currentPageIndex) ?
Beta Was this translation helpful? Give feedback.
All reactions