click-ui icon indicating copy to clipboard operation
click-ui copied to clipboard

[SSR Support] Library breaks in server-side rendering environments

Open thelevicole opened this issue 8 months ago • 0 comments

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)

Image


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.

thelevicole avatar Jun 04 '25 10:06 thelevicole