Skip to content

feature: React migration phase 4 — item details & recursive comments - #868

Closed
vibhaseshadri-cognition wants to merge 1 commit into
devin/1791295334-react-phase3-feedsfrom
devin/1791295336-react-phase4-item-details
Closed

vibhaseshadri-cognition wants to merge 1 commit into
devin/1791295334-react-phase3-feedsfrom
devin/1791295336-react-phase4-item-details

Conversation

@vibhaseshadri-cognition

Copy link
Copy Markdown

Summary

Replaces the /item/:id placeholder with a port of Angular's item-details + recursive comment components (stacked on Phase 2).

  • react/src/item-details/ItemDetails.tsx (+ .scss): useParams() id → fetchItemContent(Number(id), signal); aborts on id change/unmount and ignores AbortError. Loader / ErrorMessage("Could not load item comments.") / loaded, root div.main-content[data-testid=item-details][data-item-id] rendered in every state. window.scrollTo(0, 0) on mount. Mobile .item-header with .back-button → navigate(-1); laptop header with item-header (comments_count > 0 or job) / head-margin (item.text), external vs internal title link (openLinkInNewTab → target="_blank" rel="noopener"), domain, .subtext, formatCommentCount. Poll .pollContent options via SafeHtml, .pollBar width points / poll_votes_count * 100%. item.content → SafeHtml as="p" className="subject".
  • react/src/item-details/Comment.tsx (+ .scss): recursive; deleted → .deleted-meta; otherwise .meta (+meta-collapse), [-]/[+] toggle, /user/{user} link, time, SafeHtml comment-text, nested ul.subtree. Collapsed body uses the hidden attribute so subtrees stay mounted (Angular [hidden]).
  • Tests: ItemDetails.test.tsx, Comment.test.tsx (mocked API module); Playwright e2e/item-details.spec.ts with e2e/fixtures/item-details.ts (nested tree, deleted comment, poll + poll options, mobile back button, API failure).

Parity notes / intentional deviations

  • Toggle and back button are role="button", tabIndex=0, Enter/Space (shared onActivateKey). Toggle has aria-expanded and aria-label="Collapse|Expand comment by {user}" (visible text still [-]/[+]). Back button has aria-label="Back".
  • On id change the previous item is cleared and the loader shows (Angular kept the stale item/error on screen until the new one arrived).
  • poll_votes_count === 0 → bar width 0% (Angular produced an invalid NaN%).
  • hasUrl is null-safe (item.url?.indexOf('http') === 0). item.text isn't in the shared Story model, so it's read through a local Story & { text?: string } type instead of changing shared models.
  • SCSS has no view encapsulation, so all rules are nested under .item-view / .comment. Item-details ul padding only targets .comment-list (in Angular it never reached the comment subtrees).
  • Note: src/App.test.tsx (which I can't edit) now logs jsdom's "Not implemented: window.scrollTo" when it renders the item route. It's console noise only and tests pass.

Coverage (npm test)

All files          |     100 |      100 |     100 |     100 |
 src/item-details  |     100 |      100 |     100 |     100 |
  Comment.tsx      |     100 |      100 |     100 |     100 |
  ItemDetails.tsx  |     100 |      100 |     100 |     100 |

Locally passing: format:check, lint, typecheck, test (95 tests), build, e2e (15 tests).

Devin-Org: engineering

Link to Devin session: https://app.devin.ai/sessions/d4b630f04b8f488ea0d9c8f4729aa6e6
Open in Devin Desktop: https://app.devin.ai/desktop/session/d4b630f04b8f488ea0d9c8f4729aa6e6?variant=devin
Requested by: @vibhaseshadri-cognition

@devin-ai-integration

Copy link
Copy Markdown

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

@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1791295336-react-phase4-item-details branch from ac6e740 to f24934d Compare October 6, 2026 14:10
@devin-ai-integration
devin-ai-integration Bot changed the base branch from devin/1791294931-react-phase2-shell to devin/1791295334-react-phase3-feeds October 6, 2026 14:10
… tests and e2e (migration phase 4)

Co-Authored-By: Vibha  Seshadri <vibha.seshadri@cognition.ai>
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1791295334-react-phase3-feeds branch from 7a2a89a to 52340da Compare October 6, 2026 14:54
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1791295336-react-phase4-item-details branch from f24934d to 44b2dd9 Compare October 6, 2026 14:54
@devin-ai-integration

Copy link
Copy Markdown

Closing as part of the nightly demo-repo reset — reopen if this demo artifact is still needed.

@devin-ai-integration
devin-ai-integration Bot deleted the devin/1791295336-react-phase4-item-details branch October 26, 2026 12:11
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.

1 participant