Fix double-stringified content in proposal MCP tools#12
Merged
Conversation
Remove explicit JSON.stringify() in createProposal and updateProposal. Supabase serializes object inputs into json columns correctly on its own, so the manual stringify caused content to be stored as a JSON-string value (the JSON object wrapped in quotes) instead of a JSON-object value. The Lexical editor on the client side expects an object and crashes with "Application Error" when it receives a string, making proposals unviewable after they are created or updated through the MCP tools. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
JakeLeoDev
approved these changes
May 7, 2026
JakeLeoDev
left a comment
Owner
There was a problem hiding this comment.
Correct and minimal fix. Supabase handles json column serialization natively — the manual JSON.stringify was double-encoding the content field, storing a string instead of an object and crashing the Lexical editor. The updateProposal cleanup (removing the special-case branch) is a nice bonus. LGTM.
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
JSON.stringify()on thecontentfield increateProposalandupdateProposal.jsoncolumns correctly on its own — the manual stringify caused content to be stored as a JSON-string value (the JSON object wrapped in quotes) instead of a JSON-object value.Why this matters
The Lexical editor on the client side expects an object. When proposals are created or updated through the MCP tools, the editor instead receives a string and crashes with Application Error, making the proposal unviewable in the UI.
Reproduction (before this fix)
updateProposalMCP tool to updatecontentwith a Lexical object:{ root: { children: [...] } }.contentis now a JSON-encoded string instead of an object.After this fix
updateProposalandcreateProposalpass the Lexical object straight through to Supabase. Thejsoncolumn receives a structured object as expected, and the editor renders the proposal normally.Test plan
createProposalMCP tool with a Lexical content object → open in UI, content renders.updateProposalMCP tool with a new Lexical content object → open in UI, content renders.updateProposal→getProposal→contentis an object, not a string.🤖 Generated with Claude Code