Sort RSS feed articles newest-first - #257
Merged
Merged
Conversation
feed.tsx rendered articles in whatever order qBittorrent's rss/items returned (feed-storage order), so they appeared randomly sorted. Add sortArticlesByDateDesc to utils/rss.ts and use it in the existing useMemo. Undated or unparseable-date articles sort last and keep their original relative order, so a feed with no dates renders unchanged.
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
app/(tabs)/rss/feed.tsxrenderedfeed.articleswith no sort at all, soarticles appeared in whatever order qBittorrent's
rss/itemsreturned(feed-storage order) — reported as "sorted randomly."
sortArticlesByDateDesc(articles: RssArticle[])toutils/rss.ts,parsing each optional
datefield the same wayformatArticleDatealreadydoes (
new Date(raw)+ aNaNguard). Newest first; articles with amissing or unparseable date sort last and keep their original relative
order (stable sort), so a feed with no dates renders exactly as it does
today.
useMemoinfeed.tsxso sorting onlyhappens when
feedchanges, not on every render.No i18n, no UI change, no API change — single-site fix scoped to the RSS
feed detail screen, which is the only place articles are listed.
Fixes #251
Test plan
npx tsc --noEmit— exit 0npm test— 78 suites / 1136 tests passing (added 6 cases totests/utils/rss.test.ts: newest-first ordering, undated-last withoriginal relative order preserved, unparseable dates treated as
undated, empty-array input, input-array-not-mutated)
npm run lint— 0 errors, 37 warnings (baseline)npm run format— cleanAGENTS.md §9) — this is a pure sort applied to already-rendered data, no
UI change.
🤖 Generated with Claude Code