Repository navigation
feat: cut over to the React PWA (integrate #932–#936, Workbox SW, Playwright e2e) - #937
eashansinha wants to merge 23 commits into
Conversation
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
Original prompt from Devin Bot
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
| manifest: false, | ||
| registerType: 'autoUpdate', | ||
| injectRegister: 'auto', | ||
| filename: 'sw.js', |
There was a problem hiding this comment.
🔴 Existing PWA installations remain on Angular
After deployment, users controlled by ngsw-worker.js keep receiving its cached Angular shell instead of registering sw.js. Its update manifest is gone, and the hosting rewrite serves React HTML for /ngsw.json, so the old worker cannot upgrade.
Learn more
The production Angular app registered a root-scoped ngsw-worker.js and precached /index.html through its app asset group. A browser already controlled by that worker can continue receiving its cached Angular HTML on every navigation. This deployment replaces the build output with React assets and sw.js, removing /ngsw.json; the SPA rewrite sends React HTML for that missing manifest instead. The old worker cannot obtain a valid Angular update, and React's registration code never runs in the cached Angular page.
Example: Alice installed the production Angular PWA last week. After this deployment, she opens the app online; ngsw-worker.js serves her old index and requests /ngsw.json, which now responds with React HTML. She remains on Angular instead of receiving the React app.
Recommended fix: Provide an explicit migration path for existing root-scoped ngsw-worker.js registrations. For example, make /ngsw.json return a genuine 404 rather than the SPA fallback so Angular can retire its worker, and verify the transition with a browser profile controlled by the old production worker before deploying.
Was this helpful? React with 👍 or 👎 to provide feedback.
Debug
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
| <app-root></app-root> | ||
|
|
||
| <div id="root"></div> | ||
| <div class="app-loader" id="content"> |
There was a problem hiding this comment.
🟡 Skip link lands on hidden loader
After React mounts, the skip link targets #content, which now sits outside #root as a hidden loader. Keyboard users cannot skip to the application.
Learn more
The skip link near the start of the body points to #content. Before the app mounts, the target is the loading element; after mounting, the CSS in the loader styles hides that element. The rendered app lives in the preceding #root, so the anchor no longer targets the content users want to reach.
Example: A keyboard user presses Tab and activates “skip to navigation” after the feed loads. The browser follows #content to the hidden loading element rather than moving into the feed or header.
Recommended fix: Place the persistent #content target around the rendered application, or move the skip link's target into the application after mount while retaining a useful target before mount. Keep the loader as a separate sibling so the #root:empty + .app-loader selector still works.
Was this helpful? React with 👍 or 👎 to provide feedback.
Debug
Co-Authored-By: Eashan Sinha <eashan.sinha@cognition.ai>
There was a problem hiding this comment.
Devin Review found 1 finding. Devin automatically fixed it.
Fixed by Devin (1)
- Homepage visits count as two pageviews — RouteAnalytics skips the redirect-only
/route, matching Angular's urlAfterRedirects; test asserts one pageview for /news/1.
Summary
Phase 3 of the Angular → React migration. Branch is based on
react-migration/1794416868-trunkand merges all five slice branches (#932 foundation, #934 app shell, #936 feeds, #935 item details, #933 user profile), then cuts the repo over to the React app.src/routes.test.tsx(feat(react): port user profile page (/user/:id) #933 vs feat(react): port feeds (FeedPage + FeedItem) with pagination #936). I kept feat(react): port feeds (FeedPage + FeedItem) with pagination #936's feed-route assertions and every slice's own tests. 73 unit tests pass.react-app/): with Angular removed, the React app is the only project. Keeping it at the root keepsfirebase.json, CI and Travis simple and avoids setting aworking-directoryeverywhere. Deleted: Angularsrc/,angular.json, karma/protractor/tslint/tsconfig.*,ngsw-config.json,yarn.lockand the Angular deps. Static assets moved unchanged fromsrc/assetstopublic/assets.vite-plugin-pwagenerateSW →dist/sw.js):appgroup (index.html, JS, CSS, favicon, manifest) +assets/**(lazy in ngsw; precached here because it's only ~350 KiB in total)navigateFallback: '/index.html'→ deep links (/item/123,/newest/1) load offlinedataGroups)index.htmlhead and body restored from the Angular one: meta, icons,/manifest.json, theme#b92b27, the#skiplink, and an empty#rootfollowed by a sibling.app-loader#contentso the#root:empty + .app-loaderstartup logo shows before React mounts. Dropped the deadmanifest.webmanifestlink and the duplicate CLI-default#1976d2theme-color.RouteAnalyticsmirrors Angular'sNavigationEndhandler (ga('set','page', url); ga('send','pageview')) on the first load and on every client-side navigation. The redirect-only/route is skipped, so you get the equivalent ofurlAfterRedirects.firebase.jsonservesdist/with an SPA rewrite andno-cacheonsw.js/index.html..github/workflows/ci.ymlruns lint, unit tests, build and a Playwrighte2ejob..travis.ymlnow builds with Node 24 and keeps the Firebase deploy.e2e/app.spec.ts; desktop and Pixel 7 Chromium; runs againstvite previewof the production build; API mocked viacontext.route): feed load and paging, item with nested comments and collapse, user page (mocked, because the live/user/:id404s), AMOLED theme persists across reload, startup loader before mount, and offline reload plus an uncached deep link served by the SW.Unchanged on purpose, to match Angular: the settings cog doesn't close an open panel; the header overlaps at 320px; the skip link targets the loader; there is no catch-all route, so bare
/newestor unknown URLs leave the loader showing.The slice PRs #932–#936 can be closed once this lands. Or merge them into trunk first; either way, this PR already contains them.
Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/9bcb935af0524ad78339307f809ed1d2
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/9bcb935af0524ad78339307f809ed1d2?variant=devin
Requested by: @eashansinha