[Website] Render Playground logs as escaped text - #4031
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR removes dangerouslySetInnerHTML() from Playground log rendering to ensure log entries containing HTML are displayed as escaped text while still highlighting severity markers.
Changes:
- Added a
splitLogHighlights()helper to split log lines into highlighted/non-highlighted segments. - Updated the log modal to render segments via React elements instead of injecting HTML.
- Added Vitest coverage to verify highlighting behavior and HTML-escaping.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/playground/website/src/components/log-modal/log-highlights.ts | Introduces a line-splitting helper that returns structured segments instead of HTML. |
| packages/playground/website/src/components/log-modal/log-highlights.spec.ts | Adds tests validating highlighting rules and that markup is treated as plain text. |
| packages/playground/website/src/components/log-modal/index.tsx | Switches rendering from dangerouslySetInnerHTML to React-rendered segments with stable keys. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Jul 13, 2026
adamziel
added a commit
that referenced
this pull request
Jul 13, 2026
## What this does Shows the SQLite database size without copying the database file into the browser's JavaScript heap. The database panel now resolves the SQLite path from the runtime document root and asks PHP to `stat()` it. The download action reuses that resolved path instead of assuming `/wordpress`. Stacked on #4031. ## Testing - `npm exec nx -- run-many -t lint typecheck -p playground-website --parallel=2` - `npm exec nx -- run playground-website:e2e:playwright -- --grep="should stat the database size without reading the database into JavaScript" --project=chromium` - assertion passed; local Vite startup needed Playwright's first retry because its shared dependency cache omitted a generated chunk
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.
Playground logs are currently passed through
dangerouslySetInnerHTML()soError:andFatal:can be marked. A log entry containing HTML is therefore interpreted as page markup instead of displayed as log text.This splits severity markers into plain data and lets React render every segment. Log text is escaped, the markers remain highlighted, and entries keep their original append-only index when filtering or reversing the list.
Tested with:
npm exec nx -- test playground-website --testFile=log-highlights.spec.tsnpm exec nx -- run playground-website:lintnpm exec nx -- run playground-website:typecheck