Skip to content

feat: add 'Latest Only' dropdown to release timeline#219

Merged
AmintaCCCP merged 2 commits into
mainfrom
feature/release-latest-mode
Jun 11, 2026
Merged

feat: add 'Latest Only' dropdown to release timeline#219
AmintaCCCP merged 2 commits into
mainfrom
feature/release-latest-mode

Conversation

@AmintaCCCP

@AmintaCCCP AmintaCCCP commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Summary

Add a new dropdown next to existing filters on the Release Timeline page that allows showing only the latest release per repository.

Changes

New Feature: Latest Only Mode

  • Added a new dropdown with two options: Show All Versions / Latest Version Only
  • When "Latest Only" is selected, each repository shows only its most recent release
  • The setting is persisted via IndexedDB (survives page refresh and app restart)

Filter Compatibility

  • Works together with existing asset type filters
  • Works together with unread-only toggle
  • All three filters (asset type, unread, latest) can be active simultaneously

Smart Mark-as-Read

  • When user marks the latest release of a repo as read in "Latest Only" mode, all other releases of that repo are automatically marked as read
  • This provides a natural workflow: see only latest → mark as read → repo disappears from list

UI

  • New dropdown follows the same visual pattern as existing dropdowns (Show Mode, View Mode)
  • Added "(latest only)" indicator in results info when mode is active
  • Dropdowns have mutual exclusion (opening one closes others)

Files Changed

  • — Added to AppState
  • — State, action, persistence, cascade logic
  • — UI and filtering logic

Summary by CodeRabbit

  • New Features
    • Introduced "Latest Mode" filter to show all releases or only the latest release per repository.
    • Added a Latest Mode dropdown and header indicator for quick toggling; preference is persisted.
    • When Latest Mode is active, marking a repository's latest release as read will mark that repository's releases as read.
  • Bug Fixes
    • Improved filtering so Latest Mode works correctly with view and unread filters.

Add a new dropdown next to existing filters that allows showing only the
latest release per repository. The setting is persisted and works together
with existing filters and unread-only toggle.

When user marks the latest release of a repo as read in 'Latest Only' mode,
all other releases of that repo are also marked as read.

Changes:
- Add releaseLatestMode state to AppState and persist it
- Add setReleaseLatestMode action to store
- Add latest-only filtering logic in ReleaseTimeline
- Add dropdown UI with mutual exclusion with other dropdowns
- Cascade mark-as-read when in latest mode
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f5f21017-fecc-4201-bad9-912242c6ecdc

📥 Commits

Reviewing files that changed from the base of the PR and between 89b9518 and f36e047.

📒 Files selected for processing (2)
  • src/components/ReleaseTimeline.tsx
  • src/store/useAppStore.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/ReleaseTimeline.tsx

📝 Walkthrough

Walkthrough

Adds a persisted releaseLatestMode with UI controls; ReleaseTimeline now can limit results to the latest release per repository, applies that reduction before unread filtering, and the store marks all repo releases read when the latest release is marked in latest mode.

Changes

Release Timeline Latest Mode Filter

Layer / File(s) Summary
Type contract and store action definition
src/types/index.ts, src/store/useAppStore.ts
AppState gains releaseLatestMode: 'all' | 'latest' and the store exports setReleaseLatestMode(mode) action.
Store persistence and read behavior
src/store/useAppStore.ts
Persist/rehydrate releaseLatestMode (default 'all'); normalize on hydrate; include in partialize; markReleaseAsRead marks all releases for a repo when the marked release is that repo's latest in latest mode.
Component filtering logic
src/components/ReleaseTimeline.tsx
Component reads mode from store, adds it to effect deps, computes latestModeReleases to keep the latest release per repo when enabled, then applies unread snapshot filtering on that set.
Component UI and handlers
src/components/ReleaseTimeline.tsx
Adds local dropdown state, handleLatestModeChange (sets mode, resets page, closes dropdown), closes latest dropdown when other dropdowns open, displays header chip in latest mode, and renders the Latest Mode dropdown UI.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ReleaseTimeline
    participant Store
    participant Data

    User->>ReleaseTimeline: toggle "Latest Mode" option
    ReleaseTimeline->>ReleaseTimeline: handleLatestModeChange('latest')
    ReleaseTimeline->>Store: setReleaseLatestMode('latest')
    Store->>Store: update and persist releaseLatestMode
    Data->>ReleaseTimeline: state/data subscription updated
    ReleaseTimeline->>ReleaseTimeline: run latestModeReleases memo (group by repo, keep latest)
    ReleaseTimeline->>ReleaseTimeline: apply unread snapshot filter if enabled
    ReleaseTimeline->>User: render filtered releases

    User->>ReleaseTimeline: mark release as read
    ReleaseTimeline->>Store: markReleaseAsRead(releaseId)
    Store->>Store: if in 'latest' and releaseId is repo latest -> mark all repo releases read
    Store->>ReleaseTimeline: emit updated read state
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 A little hop for the timeline's light,
Latest-only glows, keeping things tight.
Mark the newest read, the rest fall in line,
Repos all tidy, the view looks fine. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a 'Latest Only' dropdown to the release timeline, which is the primary feature introduced across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/release-latest-mode

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a 'latest mode' filter to the release timeline, allowing users to view only the most recent release for each repository. It updates the application state, UI components, and read-marking logic to support this feature. The review feedback suggests optimizing performance and simplifying code by avoiding unnecessary Date object parsing and comparisons, leveraging string comparisons and existing list sorting instead.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +289 to +301
const latestModeReleases = useMemo(() => {
if (releaseLatestMode !== 'latest') return preUnreadFilteredReleases;

const repoMap = new Map<number, typeof preUnreadFilteredReleases[0]>();
for (const item of preUnreadFilteredReleases) {
const repoId = item.release.repository.id;
const existing = repoMap.get(repoId);
if (!existing || new Date(item.release.published_at) > new Date(existing.release.published_at)) {
repoMap.set(repoId, item);
}
}
return Array.from(repoMap.values());
}, [preUnreadFilteredReleases, releaseLatestMode]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since preUnreadFilteredReleases is already sorted in descending order by published_at (newest first), the first release encountered for each repository is guaranteed to be the latest one. We can simplify this logic by checking if the repository ID is already in the map, completely avoiding the overhead of parsing and comparing Date objects.

  const latestModeReleases = useMemo(() => {
    if (releaseLatestMode !== 'latest') return preUnreadFilteredReleases;

    const repoMap = new Map<number, typeof preUnreadFilteredReleases[0]>();
    for (const item of preUnreadFilteredReleases) {
      const repoId = item.release.repository.id;
      if (!repoMap.has(repoId)) {
        repoMap.set(repoId, item);
      }
    }
    return Array.from(repoMap.values());
  }, [preUnreadFilteredReleases, releaseLatestMode]);

Comment thread src/store/useAppStore.ts
Comment on lines +1283 to +1285
const latestRepoRelease = repoReleases.reduce((latest, r) =>
new Date(r.published_at) > new Date(latest.published_at) ? r : latest
, repoReleases[0]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since published_at is an ISO 8601 string (always returned in UTC format from the GitHub API), we can compare the strings directly instead of parsing them into Date objects on every iteration of reduce. This is much more efficient and cleaner.

Suggested change
const latestRepoRelease = repoReleases.reduce((latest, r) =>
new Date(r.published_at) > new Date(latest.published_at) ? r : latest
, repoReleases[0]);
const latestRepoRelease = repoReleases.reduce((latest, r) =>
r.published_at > latest.published_at ? r : latest
, repoReleases[0]);

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/store/useAppStore.ts (2)

939-945: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Missing initial state value for releaseLatestMode.

The initial state block does not include releaseLatestMode. Without this, the state will be undefined until rehydration completes, which could cause runtime errors if the component accesses it before hydration.

🐛 Proposed fix

Add the initial value after releaseShowMode:

 releaseViewMode: 'timeline',
 releaseShowMode: 'all',
+releaseLatestMode: 'all',
 releaseSelectedFilters: [],
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/store/useAppStore.ts` around lines 939 - 945, The initial state is
missing releaseLatestMode, causing undefined until rehydration; add a sensible
default (e.g., 'all' or the intended enum/value) to the state object immediately
after releaseShowMode so releaseLatestMode is defined on initialization and
components won't access undefined before hydration completes; update the state
initialization where releaseViewMode, releaseShowMode, releaseSelectedFilters,
etc. are set (look for releaseShowMode and add releaseLatestMode alongside it).

1802-1808: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Missing releaseLatestMode in partialize block — setting won't persist.

The PR claims the setting is persisted via IndexedDB, but releaseLatestMode is not included in the partialize function. The normalization at line 567 will always fall back to 'all' on app restart since no value is ever saved.

🐛 Proposed fix

Add releaseLatestMode to the partialize block:

 releaseViewMode: state.releaseViewMode,
 releaseShowMode: state.releaseShowMode,
+releaseLatestMode: state.releaseLatestMode,
 releaseSelectedFilters: state.releaseSelectedFilters,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/store/useAppStore.ts` around lines 1802 - 1808, The partialize state
selector is missing releaseLatestMode so that preference never gets persisted;
update the partialize block that currently returns releaseViewMode,
releaseShowMode, releaseSelectedFilters, releaseSearchQuery,
releaseExpandedRepositories, includePreRelease, includeKeysInBackup to also
include releaseLatestMode so it is saved to IndexedDB and survives restarts
(this will prevent the normalization logic that falls back to 'all' from
overriding the user's saved setting).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/store/useAppStore.ts`:
- Around line 939-945: The initial state is missing releaseLatestMode, causing
undefined until rehydration; add a sensible default (e.g., 'all' or the intended
enum/value) to the state object immediately after releaseShowMode so
releaseLatestMode is defined on initialization and components won't access
undefined before hydration completes; update the state initialization where
releaseViewMode, releaseShowMode, releaseSelectedFilters, etc. are set (look for
releaseShowMode and add releaseLatestMode alongside it).
- Around line 1802-1808: The partialize state selector is missing
releaseLatestMode so that preference never gets persisted; update the partialize
block that currently returns releaseViewMode, releaseShowMode,
releaseSelectedFilters, releaseSearchQuery, releaseExpandedRepositories,
includePreRelease, includeKeysInBackup to also include releaseLatestMode so it
is saved to IndexedDB and survives restarts (this will prevent the normalization
logic that falls back to 'all' from overriding the user's saved setting).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fd6ded3e-4829-459f-b4dc-34f7c299261d

📥 Commits

Reviewing files that changed from the base of the PR and between e91af73 and 89b9518.

📒 Files selected for processing (3)
  • src/components/ReleaseTimeline.tsx
  • src/store/useAppStore.ts
  • src/types/index.ts

- Add releaseLatestMode to initial state (prevents undefined before hydration)
- Add releaseLatestMode to partialize block (enables persistence)
- Optimize Date comparisons: use ISO 8601 string comparison instead of Date objects
@AmintaCCCP AmintaCCCP merged commit 4f5f3dd into main Jun 11, 2026
5 checks passed
@AmintaCCCP AmintaCCCP deleted the feature/release-latest-mode branch June 11, 2026 12:07
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