Districts admin table displays description as raw HTML instead of rendered text - #227
Merged
Merged
Conversation
The description column used plain JSX interpolation, which auto-escapes the RichTextEditor-authored HTML string instead of rendering it. Use HtmlContent, consistent with how committees/news/legislation descriptions are rendered elsewhere.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The districts admin table (
/frontend/src/app/admin/districts/page.tsx, lines 106–116) renders each district'sdescriptionfield via plain JSX interpolation —<span className="text-slate-700">{desc}</span>(line 111). District descriptions are authored throughRichTextEditor(wired up inDistrictForm.tsxline 64), which stores the field as an HTML string (e.g.<p>Covers <strong>downtown</strong>...</p>), not plain text. Because React auto-escapes{desc}as text rather than markup, the admin table shows the literal tags (<p>,<strong>, etc.) instead of formatted content.This is inconsistent with the rest of the app: every other place that displays a
RichTextEditor-authored field routes it through theHtmlContentcomponent (/frontend/src/components/content/HtmlContent.tsx), which renders viadangerouslySetInnerHTML. This pattern is used for the equivalentcommittee.descriptionfield (/frontend/src/app/committees/[id]/page.tsxlines 37–38, authored by the sameRichTextEditorper/frontend/src/app/admin/committees/page.tsxlines 253–258), as well as for news and legislation body content. The districts admin table is the one place this contract is broken.Changes:
Closes #226