Skip to content

React migration 4/6: item details, polls and recursive comments - #941

Open
devin-ai-integration[bot] wants to merge 4 commits into
devin/task-2-react-foundationfrom
devin/task-2-react-item
Open

devin-ai-integration[bot] wants to merge 4 commits into
devin/task-2-react-foundationfrom
devin/task-2-react-item

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Summary

This PR ports item-details/ (the page and comment) into react-app/ and replaces the placeholder ItemDetailsPage. It is stacked on #938 (foundation) and independent of #939/#940.

  • ItemDetailsPage loads fetchItemContent(id) in an effect with an AbortController. While the item is loading it shows the loader, and on failure it shows ErrorMessage("Could not load item comments."). It keeps both the mobile header (back button → navigate(-1), Angular's Location.back()) and the desktop header, with the title, domain, points, user and comment count. Jobs hide the points, user and comment links. The open-in-new-tab setting applies to the title link.
  • Polls show each option with its points and a bar sized at points / poll_votes_count, with a guard against divide-by-zero.
  • Comment renders recursively. [-]/[+] collapses a subtree using local state (hidden, the same as Angular's [hidden]). Deleted comments show [deleted] | Comment Deleted.
  • Sanitization: Angular's [innerHTML] sanitized the API's HTML, but React's dangerouslySetInnerHTML doesn't. To keep that protection, story/comment/poll HTML now goes through DOMPurify.sanitize (utils/sanitize.ts). The one new dependency is dompurify ^3.
  • The SCSS is copied, .main-content (already global) is dropped, and the styles are scoped under .item-page / .comment, since React doesn't scope component styles the way Angular did.

ItemDetailsPage.test.tsx covers the header, nested and deleted comments, collapse/expand, poll bar widths, stripping of onerror/<script>/javascript:, the back button and the error state. Lint, typecheck, 26 tests and the build pass.

This duplicates #935 from an earlier parallel migration stack. Only one of them should land.

Devin-Org: engineering

Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/a08488aa0df94f1ba5fcd309e7df132d
Link to Bot: https://devin-gtm.devinenterprise.com/org/devin-gtm/bots/a78446fd2653463e94cefb31caca525b
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/a08488aa0df94f1ba5fcd309e7df132d?variant=devin


Note

Devin could not open this Pull Request as matthewguerra-cog: they have no GitHub connection usable for this repository.
As a fallback, Devin opened this PR as itself.


🟢 Devin fixed the finding · Follow Devin's work

Devin Review

Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown
Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@socket-security

socket-security Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addeddompurify@​3.4.171001001009270

View full report

…ols keyboard-operable

Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Devin Review found 1 finding. Devin automatically fixed it.

Fixed by Devin (1)
  • Poll HTML sanitization goes untested — Added a poll test whose option content contains onerror/script HTML and asserts it is stripped.

View findings in Devin Review · Follow Devin's work

Devin Review

devin-ai-integration Bot and others added 2 commits November 12, 2026 09:53
Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
…nitization

Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
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.

0 participants