Next.js Discord

Discord Forum

Client component rendering issues

Unanswered
Highlander posted this in #help-forum
Open in Discord
HighlanderOP
I use NextJs 14 and the app router, and on a page I have a third party table component that needs to run with 'use client'. For some reason it renders "No items found" and then replaces it with the data. I have tried to use useEffect to ensure that that the data I populate it with is received before I return the component, but when logging in useEffect it seems liek the data is there the first time around, which is perplexing. So no matter what I do, this component first renders a flash of the state when no data is received, followed by the data. I've spent hours trying to figure this out, any guidance would be greatly appreciated.

I should add that this worked fine with NextJS 13 and the Pages router, it loaded a bit slower but no empty table flash occurred.

Code: https://pastebin.com/WLqUiXG7 (simplified for clarity)

8 Replies

Dashboard is a server component, right?
HighlanderOP
Yeah, I'm not setting "use client" so it's a server component
Have you checked the console for any errors that might be forcing the tree to be rebuilt?
HighlanderOP
I have, there are errors.
Let me know if fixing the errors fixes the problem
HighlanderOP
Whoops, there are no errors, sorry!
I can't see anything wrong with the code you've shared. Is it worth sharing the un-simplified code?
HighlanderOP
I have nailed it down to this component I'm using - trying a different table component from the same library does not cause the issue - so I guess it's not my code after all. Thanks for the help!