feature: Migrate Angular 9 HN PWA to React 18 + TypeScript (pixel-perfect, visual-regression verified)#321
Open
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
…l regression parity - Port all components, services, models, styles, routing and PWA setup from Angular to React 18 + Vite - Replace RxJS services with React Context (SettingsContext) and async hooks (useHackerNewsApi) - Add Playwright visual regression suite (48 tests: every view x 3 themes x mobile/desktop + settings) passing at maxDiffPixelRatio 0.01 vs Angular baseline - Add Vitest unit tests for formatComment, SettingsContext, API functions and Item component - Remove Angular/RxJS/zone.js/karma/protractor toolchain; update README and CI Co-Authored-By: Lukas Burger <lukaskburger@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
Full rewrite of the Angular 9 Hacker News PWA to React 18 + TypeScript + Vite, with pixel-perfect parity enforced by a Playwright visual-regression suite. Every Angular component, service, model, style and the PWA service worker were ported 1:1; the Angular/RxJS/zone.js/karma/protractor toolchain was removed.
Parity is not asserted by eye — Angular baseline screenshots were captured first (Phase 0), then the React output is diffed against them. 48/48 visual-regression tests pass within
maxDiffPixelRatio: 0.01(7 scenarios × 3 themes × 2 viewports + settings panel).Architecture mapping
HackerNewsAPIService(RxJSObservable+unfetch)src/hooks/useHackerNewsApi.ts— asyncfetchfunctions + genericuseApiFetch<T>hookSettingsServicesrc/contexts/SettingsContext.tsx—SettingsProvider/useSettings(), samelocalStoragekeys +prefers-color-schemelistenerCommentPipesrc/utils/formatComment.ts*.component.ts/html/scss.scssapp.routes.ts(lazy modules)src/routes.tsxwithReact.lazyfor item/user pagesngsw-config.json)vite-plugin-pwa/ Workbox (NetworkFirstfor the HN API)Notable porting detail (non-obvious)
Angular's
ViewEncapsulationimplicitly scopes component CSS. Flattening to global SCSS leaked rules across components and broke parity until fixed, e.g.:header h1 { font-size: 16px }shrank the Settings popup title → render<Settings>outside<header>..item-details-view p { margin: 2px 0 }collapsed comment paragraph spacing → scoped to.laptop > p, .mobile > pso it doesn't reachdangerouslySetInnerHTMLcomment bodies.Theme structural selectors (
.wrapper,#header,.popup,.loader, …) are kept as literal global class names (not CSS modules) so the_themes.scssmixin selectors keep matching.Testing
npm test— Vitest unit tests (17):formatComment,SettingsContext(persistence/theme/toggles),useHackerNewsApi(mocked fetch incl. poll sub-fetch tallying),Itemrendering. All pass.npm run test:vr— Playwright visual regression. 48/48 pass.npm run lint,npm run typecheck,npm run build— all clean.Screenshots
Link to Devin session: https://app.devin.ai/sessions/80307157bda94caa8de20724c3b44f4d
Requested by: @lburgers
Devin Review
9716d1d