Skip to content

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

@thelevicole

Description

@thelevicole

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


Is there already a plan for this? Happy to help dig in if it’s on the radar.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions