Skip to content

fix(xl-ai): remove 'use client' from server entry#2860

Open
YousefED wants to merge 1 commit into
mainfrom
server-export-blocknotexl-aiserver-is-marked-as-use-client-blo-1235
Open

fix(xl-ai): remove 'use client' from server entry#2860
YousefED wants to merge 1 commit into
mainfrom
server-export-blocknotexl-aiserver-is-marked-as-use-client-blo-1235

Conversation

@YousefED

Copy link
Copy Markdown
Collaborator

Summary

The @blocknote/xl-ai/server entry was marked with a "use client" directive, which broke server-side usage.

Rationale

packages/xl-ai/src/server.ts is the dedicated build entry for @blocknote/xl-ai/server. The "use client" directive at the top of the file was copied verbatim into the built dist/server.js and dist/server.cjs. As a result, frameworks like Next.js treated the entire server bundle as client-only, causing errors such as:

Attempted to call injectDocumentStateMessages() from the server but injectDocumentStateMessages is on the client.

The directive was misplaced — the server entry is meant for server use only, and its exports are server-safe.

Changes

  • Removed the "use client"; directive from packages/xl-ai/src/server.ts.

Impact

Server-side consumers (Next.js API routes, Node.js backends) can now import from @blocknote/xl-ai/server and use exports like injectDocumentStateMessages without errors.

Verified the rebuilt dist/server.js/dist/server.cjs no longer contain "use client", and that no client-only deps (e.g. @ai-sdk/react) are pulled into the server bundle — the type-only imports are erased at build time.

Testing

  • Rebuilt the package and confirmed "use client" is gone from the server bundle and all exports remain intact.

Checklist

  • Code follows the project's coding standards.
  • Unit tests covering the new feature have been added.
  • All existing tests pass.
  • The documentation has been updated to reflect the new feature

Closes #2841

🤖 Generated with Claude Code

The "@blocknote/xl-ai/server" entry carried a "use client" directive,
which the build copied into dist/server.js. Frameworks like Next.js then
treated the whole server bundle as client-only, breaking server usage of
exports such as injectDocumentStateMessages.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blocknote Ready Ready Preview Jun 17, 2026 9:47am
blocknote-website Ready Ready Preview Jun 17, 2026 9:47am

Request Review

@pkg-pr-new

pkg-pr-new Bot commented Jun 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@blocknote/ariakit

npm i https://pkg.pr.new/@blocknote/ariakit@2860

@blocknote/code-block

npm i https://pkg.pr.new/@blocknote/code-block@2860

@blocknote/core

npm i https://pkg.pr.new/@blocknote/core@2860

@blocknote/mantine

npm i https://pkg.pr.new/@blocknote/mantine@2860

@blocknote/react

npm i https://pkg.pr.new/@blocknote/react@2860

@blocknote/server-util

npm i https://pkg.pr.new/@blocknote/server-util@2860

@blocknote/shadcn

npm i https://pkg.pr.new/@blocknote/shadcn@2860

@blocknote/xl-ai

npm i https://pkg.pr.new/@blocknote/xl-ai@2860

@blocknote/xl-docx-exporter

npm i https://pkg.pr.new/@blocknote/xl-docx-exporter@2860

@blocknote/xl-email-exporter

npm i https://pkg.pr.new/@blocknote/xl-email-exporter@2860

@blocknote/xl-multi-column

npm i https://pkg.pr.new/@blocknote/xl-multi-column@2860

@blocknote/xl-odt-exporter

npm i https://pkg.pr.new/@blocknote/xl-odt-exporter@2860

@blocknote/xl-pdf-exporter

npm i https://pkg.pr.new/@blocknote/xl-pdf-exporter@2860

commit: 0f0d481

@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://TypeCellOS.github.io/BlockNote/pr-preview/pr-2860/

Built to branch gh-pages at 2026-06-17 09:48 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server export '@blocknote/xl-ai/server' is marked as 'use client' and breaks server integration

1 participant