Hi, everyone.
I have an Next13 (with app dir) + Sanity app, and I would like to prevent hitting the Sanity endpoint on every client request. However, I'm not sure If I have set it up correctly.
I have a dynamic segment /lessons/[lessonId]/page.tsx and i use the next-sanity client to fetch data. In the build report, it says that these pages are SSG.
Here is this page, I render a "lesson". Each lesson has an array of "sessions". I want to filter each session on button clicks. Right now, I do that by useSearchParams and setting params with router.push in a "use client"-component.
It works, but when user click filter buttons, the page fetches on each click. My questions are:
- Is this because the segment page itself is a server component?
- Will each of these fetches hit the Sanity endpoint as well?
I appreciate all inputs.