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

**suggestion (performance):** Optimize data fetching in MainTopicPage #40

Open
Shloimy15e opened this issue Aug 20, 2024 · 0 comments
Open
Assignees

Comments

@Shloimy15e
Copy link
Owner

          **suggestion (performance):** Optimize data fetching in MainTopicPage

The current implementation fetches all videos for all subtopics at once. Consider implementing pagination or lazy loading to fetch videos only when needed, especially if there are many subtopics or videos.

  } = useInfiniteQuery(
    "videosBySubtopic",
    async ({ pageParam = 0 }) => {
      const limit = 10;
      const offset = pageParam * limit;
      return await fetchVideosBySubtopicPaginated(subtopics, offset, limit);
    },
    {
      getNextPageParam: (lastPage, pages) => pages.length,
    }
  );

Originally posted by @sourcery-ai[bot] in #35 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant