Potentional problem in Nextjs data fetching #67556
Unanswered
emimaricic
asked this question in
App Router
Replies: 0 comments
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey guys, I have noticed something through building my app.
I'm using Next 14, and I have async table with pagination, search filters, and many more filters that triggers router.push function.
First problem I noticed is loading, I have loading.tsx which triggers when I render the page first time, but when query params my client data table doesn't know when the fetch is happening. I have tried to add supsense fallback but doesn't work. I would be great if other content is shown but data table when its loading, loading ui shows just like it's displayed on suspense fallback
Second problem I noticed is unwanted fetches, to explain you as better as I can, in my example I'm fetching football players, and with that fetch I also have fetch call for countries, leagues and seasons. Those data shouldn't be fetched I only want to fetch filtered player data.
Does anyone have an idea for those 2 problems? Code structure:
Beta Was this translation helpful? Give feedback.
All reactions