Repository navigation
React migration phase 1: typed HN API, settings, comment util, models - #866
Closed
vibhaseshadri-cognition wants to merge 1 commit into
Closed
vibhaseshadri-cognition wants to merge 1 commit into
vibhaseshadri-cognition wants to merge 1 commit into
Conversation
…comment util, models Co-Authored-By: Vibha Seshadri <vibha.seshadri@cognition.ai>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Closing as part of the nightly demo-repo reset — reopen if this demo artifact is still needed. |
devin-ai-integration
Bot
deleted the
devin/1791294942-react-phase1-data-layer
branch
October 26, 2026 12:11
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
Phase 1 of the Angular → React migration: the framework-free data layer and settings state under
react/src/shared/, built to the shared module contract so Phase 2 (routing/UI) can consume it. Stacked on #865. No UI and noApp.tsxchanges.shared/models/: TS interfaces mirroring the Angular models. Fields the live node-hnapi can leave out are optional.Story.typeisItemType | 'link' | 'ask' | 'comment'because the API returnslink/asktoo.time_agoisstring, which is what the API actually sends (Angular typed it asnumber).User.crated_timekeeps Angular's typo. Also addsFeedName/FEED_NAMES.shared/services/hackernewsApi.ts:fetchFeed/fetchItemContent/fetchPollContent/fetchUseruse nativefetch.HN API request to /item/2 failed with status 500). An already-aborted signal rejects with itsAbortErrorbefore fetching; an abort mid-request comes through fromfetch.id+1 … id+poll.lengthload in parallel withPromise.all, thenpoll[i]is replaced andpoll_votes_countset to the sum ofpoints. The promise resolves only after every option has loaded (Angular returned the story before its poll options arrived).shared/services/settings.ts: the same localStorage keys and serialization as Angular, so existing users keep their settings. A saved theme that isn't a knownThemeis ignored and the system theme is used instead; anopenLinkInNewTabvalue that won't parse falls back tofalse(Angular would throw).getSavedTheme().SettingsProvider/useSettings/SettingsContext:matchMedia(DARK_SCHEME_QUERY)changeevents and removes the same handler on unmount. This fixes Angular'sremoveEventListener(fn.bind(this))bug.toggleSettingsis not persisted.shared/utils/comment.ts:formatCommentCount, matchingCommentPipe.src/test/matchMedia.ts: a reusablemockMatchMedia()helper for tests (jsdom has nomatchMedia; no polyfill in app code).Locally,
format:check,lint,typecheck,test,buildande2eall pass.npm testcoverageThe
0rows are type-only model files with no runtime code. 45 tests across 6 files.Devin-Org: engineering
Link to Devin session: https://app.devin.ai/sessions/05362fe05359497282a4e9d0f37366a5
Open in Devin Desktop: https://app.devin.ai/desktop/session/05362fe05359497282a4e9d0f37366a5?variant=devin
Requested by: @vibhaseshadri-cognition