devlovers.net
devlovers.net copied to clipboard
(SP: 3) [Frontend] Q&A: Code block renderer fails on legacy answerBlocks format
Issue
Q&A page crashes for some records where code blocks are stored with code field instead of content.
Current behavior
Renderer expects:
{ "type": "code", "content": "..." }
But DB may contain:
{ "type": "code", "code": "..." }
This causes undefined.trim() in CodeBlock and breaks rendering.
Expected behavior
Code blocks should render safely for both legacy (code) and current (content) formats without runtime errors.
Acceptance criteria
Q&A renderer supports both content and code for type: "code" blocks CodeBlock does not crash when input is missing/undefined Existing content format remains fully compatible No runtime error: Cannot read properties of undefined (reading 'trim')
Notes
Scope is a backward-compatibility bugfix in frontend rendering only.