Skip to content

Add new-stories indicator pill for live story arrivals#2104

Open
samuelclay wants to merge 2 commits into
mainfrom
new-stories-indicator
Open

Add new-stories indicator pill for live story arrivals#2104
samuelclay wants to merge 2 commits into
mainfrom
new-stories-indicator

Conversation

@samuelclay

Copy link
Copy Markdown
Owner

Summary

  • Floating "N new stories" pill appears over the story titles pane while reading a feed or folder when new stories arrive on the 1-minute refresh poll; clicking prepends them into the collection without disturbing infinite-scroll pagination.
  • Backend adds UserSubscription.peek_new_story_hashes, which reads the top N ranked-story hashes from Redis (zF:, zU:, or river keys) without mutating the paging cache, then returns the diff against hashes the client already has. Piggybacks on refresh_feeds to avoid a second timer.
  • Frontend adds NewStoriesIndicatorView, stories.prepend_new_stories, and a prepend path in story_titles_view. Peek is skipped for starred/briefing/search/oldest-first views. Story bodies are rehydrated via /reader/river_stories with h[].

Test plan

  • Unit tests: docker exec -t newsblur_web_new-stories-indicator python manage.py test apps.reader.tests.Test_PeekNewStoryHashes
  • Open a feed with active publishers, wait for a poll, confirm the pill appears with correct count
  • Click the pill: stories prepend at the top, scroll-to-top animates, pagination state (unread counts, no_more_stories) is untouched
  • Switch feed while pill is visible: pill hides, no stale hashes carry over
  • Verify pill does not appear for Starred, Infrequent, Search, Briefing, or oldest-first sorted views
  • Dark mode: verify pill contrast and shadow
  • Regression: infinite scroll still loads pages correctly after prepending new stories

Generated with Claude Code

samuelclay and others added 2 commits April 16, 2026 07:41
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Floating "N new stories" pill appears while reading a feed or folder
when new stories arrive on the 1-minute refresh poll. Clicking prepends
the stories into the collection without disturbing infinite-scroll
pagination.

- Backend: UserSubscription.peek_new_story_hashes reads the top N
  ranked-story hashes from Redis (zF:, zU:, or river keys) without
  mutating the paging cache, then returns the diff against hashes the
  client already has. Wired through refresh_feeds so we don't need a
  second timer.
- Frontend: NewStoriesIndicatorView renders a fixed-position pill above
  the story titles pane; reader.js builds the peek params based on the
  active view (skipped for starred/briefing/search/oldest-first) and
  prepends new stories via stories.prepend_new_stories +
  story_titles_view prepend path. Uses /reader/river_stories with h[]
  to rehydrate specific hashes.
- Tests: peek_new_story_hashes returns unseen hashes in server order,
  handles missing cache, and never touches delete/zadd/expire on the
  paging keys.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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