Skip to content

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

@ViktorSvertoka

Description

@ViktorSvertoka

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.

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions