Skip to content
Discussion options

You must be logged in to vote

Seems to have found a solution that fits the specific requirements of mine, though I'm afraid it might not be the optimal one.

const userInfo: UseInfiniteQueryResult<IUser[]> = useInfiniteQuery(
    ["user", topicId],
    ({ pageParam = data?.pages[0].map((post) => post.userId) }) =>
      ky
        .get(
          `${API_ROOT}/user?${pageParam
            .filter(Boolean)
            .map((userId: number) => `id=${userId}`)
            .join("&")}`
        )
        .json(),
    {
      enabled: open && (data?.pages.length ?? 0) >= 1,
    }
  );

const [sentryRef] = useInfiniteScroll({
    // ...
    onLoadMore: () => {
      if (isLoading) {
        return;
      }
      fetchNextPage().

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by CoolSpring8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant