devlovers.net icon indicating copy to clipboard operation
devlovers.net copied to clipboard

(SP: 3) [Frontend] Q&A: Code block renderer fails on legacy answerBlocks format

Open ViktorSvertoka opened this issue 8 months ago • 0 comments

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.

ViktorSvertoka avatar Mar 24 '26 14:03 ViktorSvertoka