Skip to content

Districts admin table displays description as raw HTML instead of rendered text - #227

Merged
calebyhan merged 1 commit into
mainfrom
226/districts-admin-raw-html-description
Sep 8, 2026
Merged

calebyhan merged 1 commit into
mainfrom
226/districts-admin-raw-html-description

Conversation

@calebyhan

Copy link
Copy Markdown
Contributor

The districts admin table (/frontend/src/app/admin/districts/page.tsx, lines 106–116) renders each district's description field via plain JSX interpolation — <span className="text-slate-700">{desc}</span> (line 111). District descriptions are authored through RichTextEditor (wired up in DistrictForm.tsx line 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 the HtmlContent component (/frontend/src/components/content/HtmlContent.tsx), which renders via dangerouslySetInnerHTML. This pattern is used for the equivalent committee.description field (/frontend/src/app/committees/[id]/page.tsx lines 37–38, authored by the same RichTextEditor per /frontend/src/app/admin/committees/page.tsx lines 253–258), as well as for news and legislation body content. The districts admin table is the one place this contract is broken.

Changes:

  • yuppers

Closes #226

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.
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Test Results

642 tests  ±0   642 ✅ ±0   59s ⏱️ +14s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit be136df. ± Comparison against base commit 0ac1d2e.

@MasonMines2006 MasonMines2006 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@calebyhan
calebyhan merged commit cef1c86 into main Sep 8, 2026
3 checks passed
@calebyhan
calebyhan deleted the 226/districts-admin-raw-html-description branch September 8, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Districts admin table displays description as raw HTML instead of rendered text

2 participants