Fix recent stories showing only 1 record and add Load More pagination - #55
Conversation
When the recent stories index exists but has fewer entries than the requested limit (e.g. only stories created after the index feature was deployed), the handler now falls through to the legacy KV scan to pick up older pre-index stories. Duplicate entries are skipped by tracking indexed keys in a Set. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Server: add offset query param, return hasMore flag, increase default limit from 5 to 10 (max 50) - Service: pass offset param to API - Dashboard: load 10 stories initially, show 'Load More' button when more are available, append next page on click with loading spinner Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
commitstory | 8e4e76f | Commit Preview URL Branch Preview URL |
Jul 16 2026, 08:30 PM |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughRecent Stories now support paginated requests and responses. The server merges indexed and legacy results, while the dashboard appends additional pages through a loading-aware “Load More” control. ChangesRecent Stories Pagination
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant DashboardComponent
participant StoryService
participant handleRecentStories
participant KV
DashboardComponent->>StoryService: Request recent stories page
StoryService->>handleRecentStories: Send limit and offset
handleRecentStories->>KV: Read indexed and legacy stories
KV-->>handleRecentStories: Return story data
handleRecentStories-->>StoryService: Return stories and hasMore
StoryService-->>DashboardComponent: Update list and pagination state
DashboardComponent->>StoryService: Request next page on Load More
Suggested labels: Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. Comment |
Why
The "Recent Stories" section on the dashboard was only showing a single story even though more than 10 existed in KV. This happened because the
__recent_stories_index__(introduced for fast lookups) contained only stories created after the index feature was deployed. Once the index existed -- even with just 1 entry -- the legacy KV scan fallback was completely skipped, hiding all older stories.Additionally, the default limit was only 5, with no way to see more.
What changed
Server-side fix (server.ts):
offsetquery parameter for pagination and ahasMoreboolean in the response.Frontend (story.service.ts + dashboard.component.ts):
offsetparameter.Notes
Summary by CodeRabbit