fix(web): drop react-dom/server from inline-mention-editor bundle#1229
Merged
MODSetter merged 1 commit intoMODSetter:devfrom Apr 15, 2026
Merged
fix(web): drop react-dom/server from inline-mention-editor bundle#1229MODSetter merged 1 commit intoMODSetter:devfrom
MODSetter merged 1 commit intoMODSetter:devfrom
Conversation
Replace ReactDOMServer.renderToString with a tiny createRoot + flushSync helper so react-dom/server is no longer pulled into the client bundle on every chat page load. react-dom is already in the bundle (React itself uses it), so this adds zero new runtime weight. Fixes MODSetter#1189.
|
@xr843 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Review by RecurseML
🔍 Review performed on 656e061..2727aeb
✨ No bugs found, your code is sparkling clean
✅ Files analyzed, no issues (1)
• surfsense_web/components/assistant-ui/inline-mention-editor.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1189.
surfsense_web/components/assistant-ui/inline-mention-editor.tsxwasstatically importing
react-dom/serveronly to callrenderToStringtwice — once for a connector icon and once for the X close button on
mention chips. Because this module is imported transitively by
thread.tsx(the main chat component), the entire server-renderingruntime was being loaded into the client bundle on every chat page load.
Change
Replace
ReactDOMServer.renderToString(...)with a small client-sidehelper that uses
createRoot+flushSync:react-domandreact-dom/clientare already in the client bundle(React itself imports them), so this swap adds zero new runtime
weight while dropping
react-dom/serverentirely.Testing
react-dom/serveris no longer imported by this file (grep confirms0 references in the file)
construction, so the helper produces equivalent output
pnpm --filter surfsense_web buildlocally to verify thebundle no longer contains
react-dom-server-legacy.production.min.json the chat route
Acceptance criteria (from #1189)
react-dom/serveris NOT imported anywhere ininline-mention-editor.tsxnext buildsucceeds (needs maintainer CI)High-level PR Summary
This PR removes the
react-dom/serverdependency from the client bundle by replacing twoReactDOMServer.renderToString()calls with a lightweight client-side helper function. The newrenderElementToHTML()function usescreateRootandflushSyncfromreact-dom/client(already in the bundle) to achieve the same result for rendering mention chip icons and close buttons, eliminating unnecessary server-rendering code from the chat page bundle without adding new runtime weight.⏱️ Estimated Review Time: 5-15 minutes
💡 Review Order Suggestion
surfsense_web/components/assistant-ui/inline-mention-editor.tsx