Skip to content

Limit releases to only show most recent ones #4570

Open
devnchill wants to merge 7 commits intoOWASP:mainfrom
devnchill:feat/limit-release
Open

Limit releases to only show most recent ones #4570
devnchill wants to merge 7 commits intoOWASP:mainfrom
devnchill:feat/limit-release

Conversation

@devnchill
Copy link
Copy Markdown

Resolves #4560

Earlier the snapshots page would display all release at once making the ui look overwhelming.
This pr:

  • limits the number of releases to 9 most recent releases
  • adds a show all button which on clicking would show all the releases
  • would change its state to show less which would again collapse it to show 9 most recent ones.

Checklist

  • Required: I followed the contributing workflow
  • Required: I verified that my code works as intended and resolves the issue as described
  • Required: I ran make check-test locally: all warnings addressed, tests passed
  • I used AI for code, documentation, tests, or communication related to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 2026

Warning

Rate limit exceeded

@devnchill has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 12 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 6 minutes and 12 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 77da9d15-de1a-4625-92ec-977b3f4d0b9c

📥 Commits

Reviewing files that changed from the base of the PR and between 8df6804 and 102607c.

📒 Files selected for processing (4)
  • frontend/__tests__/unit/components/SnapshotReleaseSection.test.tsx
  • frontend/src/app/community/snapshots/[id]/page.tsx
  • frontend/src/components/SnapshotReleaseSection.tsx
  • frontend/src/utils/constants.ts

Walkthrough

Adds a client-side toggle to limit visible snapshot.newReleases by default, introduces MAX_RELEASES_TO_SHOW = 9, moves release list rendering into a new ReleasesSection component, and resets the toggle when the snapshot object changes.

Changes

Cohort / File(s) Summary
Snapshot page
frontend/src/app/community/snapshots/[id]/page.tsx
Replaced inline mapping of snapshot.newReleases with ReleasesSection; added showAllReleases state, a useEffect to reset it when snapshot changes, and an onToggle handler passed to the new component.
Releases UI component
frontend/src/components/SnapshotReleaseSection.tsx
Added ReleasesSection component that accepts releases, showAll, and onToggle; slices releases to MAX_RELEASES_TO_SHOW when showAll is false, renders Release items with stable keys (fallbacks using tag/repo/index) and a centered toggle button when count exceeds the limit.
Constants
frontend/src/utils/constants.ts
Added exported MAX_RELEASES_TO_SHOW = 9 to control the default number of visible releases.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • arkid15r
  • kasya
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Limit releases to only show most recent ones' accurately describes the main objective of the PR.
Description check ✅ Passed The description clearly explains the problem, solution, and implementation details with specific references to the resolved issue and feature checklist.
Linked Issues check ✅ Passed The PR successfully implements all objectives from issue #4560: displays only 9 most recent releases by default, hides remaining releases, and provides a toggle button for users to reveal all releases.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the linked issue: constant definition, page component refactoring, and new ReleasesSection component for release display management.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@devnchill
Copy link
Copy Markdown
Author

On contribution guidelines, it is mentioned that if pr implements new feature, will have to also write tests for it, so ig I don't have to be assigned again for tests and can instead write tests directly in this same pr?

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/src/app/community/snapshots/`[id]/page.tsx:
- Around line 36-40: The effect that currently only sets showAllReleases to true
must reset the toggle when the incoming snapshot changes: update the useEffect
that watches snapshot so it sets setShowAllReleases(snapshot?.newReleases &&
snapshot.newReleases.length <= MAX_RELEASES_TO_SHOW) (or explicitly set true
when length <= MAX_RELEASES_TO_SHOW and false otherwise) so the
collapsed/expanded state is recomputed on each new snapshot; reference the
existing useEffect, snapshot, newReleases, MAX_RELEASES_TO_SHOW, and
setShowAllReleases symbols when making the change.
- Around line 107-110: The classname in the showButton object contains a typo
'darK:hover:text-white' that prevents Tailwind's dark variant from applying;
update the classname string in the showButton definition to use the correct
lowercase variant 'dark:hover:text-white' so the dark-mode hover style is
applied (locate the showButton constant and fix the classname property).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 918a8d62-d85b-4af0-ab90-fe466fbfb6c8

📥 Commits

Reviewing files that changed from the base of the PR and between 2ee195f and 4b317f1.

📒 Files selected for processing (1)
  • frontend/src/app/community/snapshots/[id]/page.tsx

Comment thread frontend/src/app/community/snapshots/[id]/page.tsx
Comment thread frontend/src/app/community/snapshots/[id]/page.tsx Outdated
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file

Confidence score: 4/5

  • This PR is likely safe to merge, with minimal risk: the reported issue is a localized styling typo rather than a functional or data-impacting bug.
  • In frontend/src/app/community/snapshots/[id]/page.tsx, darK:hover:text-white should be dark:hover:text-white; because Tailwind variants are case-sensitive, the dark-mode hover text color class is silently ignored.
  • User impact appears limited to dark-mode hover visuals on that page, so this is a minor UX regression rather than a merge-blocking defect.
  • Pay close attention to frontend/src/app/community/snapshots/[id]/page.tsx - fix the dark: variant casing to restore intended dark-mode hover styling.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="frontend/src/app/community/snapshots/[id]/page.tsx">

<violation number="1" location="frontend/src/app/community/snapshots/[id]/page.tsx:110">
P2: `darK:hover:text-white` has an uppercase `K` — Tailwind's `dark:` variant is case-sensitive and must be all-lowercase. This typo silently drops the dark-mode hover style.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread frontend/src/app/community/snapshots/[id]/page.tsx Outdated
coderabbitai[bot]
coderabbitai Bot previously approved these changes Apr 21, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

0 issues found across 1 file (changes from recent commits).

Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Apr 21, 2026
cubic-dev-ai[bot]
cubic-dev-ai Bot previously approved these changes Apr 21, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

0 issues found across 2 files (changes from recent commits).

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
frontend/src/components/SnapshotReleaseSection.tsx (2)

24-31: Remove the redundant cast and key fallback.

release is already ReleaseType, and Release.id is required in frontend/src/types/release.ts, so the unknown cast and fallback key only hide contract regressions.

Proposed cleanup
             <Release
-              key={
-                release.id || `${release.tagName}-${release.repositoryName ?? 'unknown'}-${index}`
-              }
-              release={release as unknown as ReleaseType}
+              key={release.id}
+              release={release}
               showAvatar={true}
               index={index}
             />

Please verify with the existing TypeScript check after removing the cast.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/components/SnapshotReleaseSection.tsx` around lines 24 - 31,
Remove the redundant type cast and fallback key: pass release directly (no "as
unknown as ReleaseType") and use release.id as the key (remove the
`${release.tagName}...` fallback), since ReleaseType and Release.id are
required; update the JSX in the Release component invocation (the Release
element, props `release` and `key`) and run the TypeScript check to verify there
are no type errors.

12-15: Make the toggle state clearer for assistive tech.

Use release-specific button text and expose the expanded state.

Proposed accessibility refinement
   const showButton = {
-    label: showAll ? 'show less' : 'show all',
+    label: showAll ? 'Show less releases' : 'Show all releases',
     classname:
       'dark:hover:text-white rounded-md border-1 font-light border-blue-400 p-2 text-blue-400 hover:bg-blue-500 hover:text-white',
   }
-          <button className={showButton.classname} type="button" onClick={onToggle}>
+          <button
+            aria-expanded={showAll}
+            className={showButton.classname}
+            type="button"
+            onClick={onToggle}
+          >
             {showButton.label}
           </button>

Also applies to: 35-39

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/components/SnapshotReleaseSection.tsx` around lines 12 - 15, The
toggle button in SnapshotReleaseSection currently uses a generic label and
doesn't expose expanded state; update the showButton logic (and the similar
button block around lines 35-39) to produce release-specific labels (e.g.,
include the release name or version via the component prop/state used in
SnapshotReleaseSection) and ensure the rendered button exposes its expanded
state for assistive tech by adding aria-expanded={showAll} and an aria-controls
that points to the collapsible content's id; adjust classname generation only as
needed and keep the same button element (refer to showButton and showAll) so
screen readers read distinct, contextual labels and know when the panel is
expanded.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@frontend/src/components/SnapshotReleaseSection.tsx`:
- Around line 24-31: Remove the redundant type cast and fallback key: pass
release directly (no "as unknown as ReleaseType") and use release.id as the key
(remove the `${release.tagName}...` fallback), since ReleaseType and Release.id
are required; update the JSX in the Release component invocation (the Release
element, props `release` and `key`) and run the TypeScript check to verify there
are no type errors.
- Around line 12-15: The toggle button in SnapshotReleaseSection currently uses
a generic label and doesn't expose expanded state; update the showButton logic
(and the similar button block around lines 35-39) to produce release-specific
labels (e.g., include the release name or version via the component prop/state
used in SnapshotReleaseSection) and ensure the rendered button exposes its
expanded state for assistive tech by adding aria-expanded={showAll} and an
aria-controls that points to the collapsible content's id; adjust classname
generation only as needed and keep the same button element (refer to showButton
and showAll) so screen readers read distinct, contextual labels and know when
the panel is expanded.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d6d748d3-9647-4744-85bf-f369199df8a2

📥 Commits

Reviewing files that changed from the base of the PR and between 5131416 and 8df6804.

📒 Files selected for processing (2)
  • frontend/src/app/community/snapshots/[id]/page.tsx
  • frontend/src/components/SnapshotReleaseSection.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/app/community/snapshots/[id]/page.tsx

coderabbitai[bot]
coderabbitai Bot previously approved these changes Apr 22, 2026
cubic-dev-ai[bot]
cubic-dev-ai Bot previously approved these changes Apr 22, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

0 issues found across 2 files (changes from recent commits).

@devnchill devnchill force-pushed the feat/limit-release branch from 73e74da to 102607c Compare April 22, 2026 17:16
@devnchill devnchill marked this pull request as ready for review April 22, 2026 17:17
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Limit visible New Releases on Snapshot page

1 participant