click-ui
click-ui copied to clipboard
[SSR Support] Library breaks in server-side rendering environments
When using the library in server-side rendering frameworks like Next.js or Docusaurus, things go sideways. Depending on the framework, the app will either fail entirely on the server or throw hydration errors in the browser.
Next.js (server side)
⨯ TypeError: Cannot read properties of undefined (reading 'ReactCurrentDispatcher')
at (ssr)/./node_modules/@clickhouse/click-ui/dist/click-ui.es.js (.next/server/vendor-chunks/@clickhouse.js:20:1)
at __webpack_require__ (.next/server/webpack-runtime.js:33:43)
at eval (webpack-internal:///(ssr)/./components/Main.tsx:7:78)
at (ssr)/./components/Main.tsx (.next/server/app/page.js:130:1)
at Object.__webpack_require__ [as require] (.next/server/webpack-runtime.js:33:43) {
digest: '38619909'
}
Docusaurus (client side)
Impact
We’re leaning more and more on SSR in our projects:
- Our docs site (Docusaurus) and marketing site (Next.js) both rely on SSR/static generation.
- We're building more demo apps that use SSR by default.
Would love to get the library working smoothly in SSR environments out of the box
Related issues
- #588
Is there already a plan for this? Happy to help dig in if it’s on the radar.