Skip to content

Fix double-stringified content in proposal MCP tools#12

Merged
JakeLeoDev merged 1 commit into
mainfrom
fix/update-proposal-content-stringify
May 7, 2026
Merged

Fix double-stringified content in proposal MCP tools#12
JakeLeoDev merged 1 commit into
mainfrom
fix/update-proposal-content-stringify

Conversation

@lukasfehling

Copy link
Copy Markdown
Collaborator

Summary

  • Remove explicit JSON.stringify() on the content field in createProposal and updateProposal.
  • Supabase serializes object inputs into json columns 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)

  1. Use the updateProposal MCP tool to update content with a Lexical object: { root: { children: [...] } }.
  2. Refetch the proposal — content is now a JSON-encoded string instead of an object.
  3. Open the proposal in the Proposit UI → Application Error.

After this fix

updateProposal and createProposal pass the Lexical object straight through to Supabase. The json column receives a structured object as expected, and the editor renders the proposal normally.

Test plan

  • Create a new proposal via createProposal MCP tool with a Lexical content object → open in UI, content renders.
  • Update an existing proposal via updateProposal MCP tool with a new Lexical content object → open in UI, content renders.
  • Round-trip: updateProposalgetProposalcontent is an object, not a string.

🤖 Generated with Claude Code

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>
@vercel

vercel Bot commented May 7, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
proposit Ready Ready Preview, Comment May 7, 2026 4:56pm

@JakeLeoDev JakeLeoDev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@JakeLeoDev JakeLeoDev merged commit 82838ce into main May 7, 2026
3 checks passed
@JakeLeoDev JakeLeoDev deleted the fix/update-proposal-content-stringify branch May 7, 2026 17:33
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.

2 participants