Skip to content
SprecherEast
Issue 227

bug: An internal link in an FAQ answer disappears from the page

Back to our plan
Done
bugfrontendcmspriority: medium

Type

bug

Summary

An internal link in an FAQ answer disappears from the page, with its text.

Problem

FAQ answers are loaded at depth: 0, so an internal link holds only the linked document's id. internalDocToHref (src/components/RichText/index.tsx:32) expects a populated document and throws. Payload logs "Error converting lexical node to JSX" and drops the link and its text; the page still returns 200, and the JSON-LD keeps the text. Editors can add such links today: the FAQ editor allows links to pages and posts. Found and reproduced in the review of #224; it's the same on main.

Proposed fix

Make internalDocToHref tolerant: if the value is an id, don't throw. Render the link text without a link and log a warning. Then load FAQ answers at depth: 1 with populate limited to slug for pages and posts, so links work.

Acceptance criteria

  • Not done: An FAQ answer linking a page or a post shows a working link on /faq.
  • Not done: A link whose document can't be resolved shows its text, and the page doesn't log a render error.
  • Not done: Unit test for internalDocToHref with an id and with a populated document.

Area

frontend, cms

Priority

medium


Generated by Claude Code, opens in a new tab

See it on GitHub, opens in a new tab