You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Could there ever be a tool for nextjs that would tell you when a component doesnt need to be a client component? I have hundreds of client components on a project and im sure some of them dont need to be one, but I just can't bother going one by one and seeing if any would crash the app if they weren't "use client". In most cases you can't even tell that it should be a client component since there are so many library abstractions and exceptions in sections of the app where they are rendered both on a client context (therefore also becomes a client component) and server
Non-Goals
I've thought about it possibly happening automatically on the background but I think not being explicit about it would bring chaos
Background
Would bring improved performance overall for an end user.
Proposal
Maybe an option in the next config file or possibly a package like "use server" that you import on the layout, that prints on the console a warning indicating the name of the file that doesn't need to be 'use client'
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Could there ever be a tool for nextjs that would tell you when a component doesnt need to be a client component? I have hundreds of client components on a project and im sure some of them dont need to be one, but I just can't bother going one by one and seeing if any would crash the app if they weren't "use client". In most cases you can't even tell that it should be a client component since there are so many library abstractions and exceptions in sections of the app where they are rendered both on a client context (therefore also becomes a client component) and server
Non-Goals
I've thought about it possibly happening automatically on the background but I think not being explicit about it would bring chaos
Background
Would bring improved performance overall for an end user.
Proposal
Maybe an option in the next config file or possibly a package like "use server" that you import on the layout, that prints on the console a warning indicating the name of the file that doesn't need to be 'use client'
Beta Was this translation helpful? Give feedback.
All reactions