Skip to content

feat: migrate Angular 9 PWA to React 18 + TypeScript + Vite#366

Open
vibhaseshadri-cognition wants to merge 1 commit into
masterfrom
devin-06.18.2026-vibha/migrate-angular-to-react
Open

feat: migrate Angular 9 PWA to React 18 + TypeScript + Vite#366
vibhaseshadri-cognition wants to merge 1 commit into
masterfrom
devin-06.18.2026-vibha/migrate-angular-to-react

Conversation

@vibhaseshadri-cognition

@vibhaseshadri-cognition vibhaseshadri-cognition commented Jun 18, 2026

Copy link
Copy Markdown

Summary

Full migration of the Hacker News PWA from Angular 9 to React 18 + TypeScript 5 + Vite 5 with complete feature parity.

Architecture change:

Angular 9 / RxJS / Webpack / @angular/service-worker
  → React 18 / react-router-dom 6 / Vite 5 / vite-plugin-pwa (Workbox)

Key design decisions:

  • State management: Angular's SettingsService (singleton mutated class) → SettingsContext with useReducer, persisting to localStorage on each action dispatch. prefers-color-scheme: dark media query listener auto-sets theme when no saved preference exists.

  • API layer: RxJS Observable + unfetch → plain async/await with native fetch. Poll handling now uses Promise.all instead of nested subscribe() calls, fixing the race condition where poll_votes_count was read before all poll items resolved.

  • Code splitting: Angular's loadChildren lazy modules → React.lazy() + <Suspense> for /item/:id and /user/:id routes.

  • Routing: Angular's data: { feedType } on parent routes with child :page → single /:feedType/:page pattern, feed type validated against allowlist in Feed.tsx.

  • PWA: ngsw-config.json (Angular service worker) → vite-plugin-pwa with Workbox. Prefetch for app shell assets, CacheFirst runtime caching for /assets/** and font/image file extensions.

  • SCSS: All theme files (_themes.scss, _theme_variables.scss, _media.scss) copied verbatim. Component styles ported with wrapper classes (e.g. .feed-content, .item-wrapper) to scope styles without Angular's view encapsulation.

Removed: All @angular/* packages, rxjs, zone.js, unfetch, protractor, karma, tslint, codelyzer, and associated config files (angular.json, ngsw-config.json, tsconfig.app.json, tsconfig.spec.json, tslint.json, karma.conf.js, e2e/).

Updated: .travis.yml (node 18, removed @angular/cli), firebase.json (public → dist), package.json (Vite scripts).

Link to Devin session: https://app.devin.ai/sessions/e6be67580e3747c38b7931ded3dd5f99
Requested by: @vibhaseshadri-cognition


Devin Review

Status Commit
⚪ Not started

Run Devin Review

💡 Connect your GitHub account to enable automatic code reviews.

Open in Devin Review (Staging)

- Replace Angular 9 with React 18, TypeScript 5, Vite 5, react-router-dom 6
- Port all models as TypeScript interfaces (Story, Comment, User, PollResult, Settings, FeedType)
- Create async API service replacing Angular/RxJS HackerNewsAPIService
- Implement SettingsContext with useReducer for theme/font/spacing/link preferences
- Port all components: Header, Footer, Settings, Loader, ErrorMessage, Item, CommentItem
- Create Feed, ItemDetails, UserProfile pages with code splitting via React.lazy
- Copy SCSS themes verbatim (default/night/amoledblack), port all component styles
- Configure vite-plugin-pwa for service worker with prefetch + lazy caching strategies
- Preserve GA tracking, PWA manifest, all meta tags, skip-nav accessibility
- Update firebase.json, .travis.yml for Vite build output
- Remove all Angular dependencies and config files

Co-Authored-By: Vibha  Seshadri <vibha.seshadri@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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