The issue of bundler with use client

We are using tsup for our bundler, but right now it will remove all the use client flag. We need to declare the JavaScript banner by ourselves. But this can mess up the server side function, as a workaround, we centralize the server side function in the toolkit/src/server folder and we stop adding use client tsup JavaScript banner there.

The convention in the app

The client side can’t not live in server side component. But sometime we want to leverage react hook beside the page.ts file. The convention we have is we have three file in the router

The first of three is the pre-defined file by Nextjs. The third file is an skeleton for us to encapsulate all the client file into it and cast a use client banner on it. In this way, the convention of app router can be properly unified.

The convention for the react-query-services

Collation is very important on maintaining and debugging react-query. But at the same time, we need to separate client-side and server-side code. The convention we built here is each react-query-service will have three file

How to debug