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

Server side data Fetching #8562

Open
laksDev9 opened this issue Jan 21, 2025 · 0 comments
Open

Server side data Fetching #8562

laksDev9 opened this issue Jan 21, 2025 · 0 comments

Comments

@laksDev9
Copy link

laksDev9 commented Jan 21, 2025

Describe the bug

https://stackblitz.com/github/tanstack/query/tree/main/examples/react/nextjs-app-prefetching?embed=1&theme=light&preset=node&file=src/index.tsx

In the provided link, there is a clear demonstration of how to perform server side data fetching in next JS using react query.
The implemntation follows the tehcniques as they are in the documentation as well. Query client provider, prefetch query, hydration and client rendering.

However, as it can be seen from the chrome dev tools (network tab), the /pokemon api call is performed in the clients side. It should be performed server side and not even appear in the network tab (client side rendered).

I have created my own example as well in the following link for a clearer demonstration of the issue: https://stackblitz.com/edit/stackblitz-starters-m13als5s?file=app%2Fpokemon%2Fpokemon.tsx

Is this an issue?

Your minimal, reproducible example

https://stackblitz.com/github/tanstack/query/tree/main/examples/react/nextjs-app-prefetching?embed=1&theme=light&preset=node&file=src/index.tsx

Steps to reproduce

  1. Click on the link
  2. Open Chrome dev tools
  3. Check that the request is performed in client side instead of server side

Expected behavior

It is expected that if a developer uses the techniques mentioned above, the request to be performed on the server side and not in the client side.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

macOS
chrome
stckblitz and locally

Tanstack Query adapter

None

TanStack Query version

5.64.2

TypeScript version

No response

Additional context

No response

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