Skip to content

fix: [AH-2859]: Re-direction issue for OCI overview cards resolved#86

Open
abhinavcode wants to merge 3 commits into
mainfrom
AH-2859
Open

fix: [AH-2859]: Re-direction issue for OCI overview cards resolved#86
abhinavcode wants to merge 3 commits into
mainfrom
AH-2859

Conversation

@abhinavcode

@abhinavcode abhinavcode commented Feb 20, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Preserves tag information in the URL when navigating tabs on the version details page.
  • Bug Fixes

    • Ensures both tag and digest parameters are maintained in the URL during navigation, keeping the UI state consistent across tabs.

@coderabbitai

coderabbitai Bot commented Feb 20, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

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

⌛ 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.

📝 Walkthrough

Walkthrough

The changes propagate a tag query parameter from the Docker version detail parent component into the OverviewCards component and include the tag when constructing redirect URLs alongside the digest parameter.

Changes

Cohort / File(s) Summary
Query Parameter Propagation
web/src/ar/pages/version-details/DockerVersion/DockerVersionOverviewContent.tsx
Retrieves tag from query params via useQueryParams and passes it to VersionOverviewCards.
Tag-aware Navigation
web/src/ar/pages/version-details/components/OverviewCards/OverviewCards.tsx
Adds optional tag?: string to VersionOverviewCardsProps and updates redirect URL construction to include tag and digest using URLSearchParams when present.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A tiny tag skips down the query lane,
Passed from parent paws to child again,
URLs stitch tag and digest in a dance,
Hop, click, redirect—give navigation a chance!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main fix: resolving a redirection issue for OCI overview cards, which matches the changeset that adds tag parameter passing to enable correct URL redirects.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch AH-2859

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.

@greptile-apps greptile-apps 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.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
web/src/ar/pages/version-details/components/OverviewCards/OverviewCards.tsx (1)

85-105: Consider memoizing handleRedirectToTab with useCallback.

The function is recreated on every render and captures tag, digest, routes, pathParams, and history. Wrapping it in useCallback with the relevant dependencies would avoid unnecessary re-creation on unrelated renders, and is idiomatic for event-handler helpers in React.

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

In `@web/src/ar/pages/version-details/components/OverviewCards/OverviewCards.tsx`
around lines 85 - 105, Memoize the handleRedirectToTab function using React's
useCallback to avoid recreating it on every render; wrap the existing
handleRedirectToTab implementation in useCallback and supply a dependency array
including tag, digest, routes, pathParams (or its individual properties:
versionIdentifier, artifactIdentifier, repositoryIdentifier, artifactType), and
history so it updates only when those inputs change; ensure the function
signature (tab: VersionDetailsTab, options: RedirectToTabOptions = {}) and its
internal URLSearchParams logic remain unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@web/src/ar/pages/version-details/components/OverviewCards/OverviewCards.tsx`:
- Around line 85-105: Memoize the handleRedirectToTab function using React's
useCallback to avoid recreating it on every render; wrap the existing
handleRedirectToTab implementation in useCallback and supply a dependency array
including tag, digest, routes, pathParams (or its individual properties:
versionIdentifier, artifactIdentifier, repositoryIdentifier, artifactType), and
history so it updates only when those inputs change; ensure the function
signature (tab: VersionDetailsTab, options: RedirectToTabOptions = {}) and its
internal URLSearchParams logic remain unchanged.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
web/src/ar/pages/version-details/components/OverviewCards/OverviewCards.tsx (1)

95-104: Refactor to either pass tag and digest to the route helper, or use a location descriptor to avoid manual URL concatenation.

Two related concerns:

  1. Design inconsistency: routes.toARVersionDetailsTab() is designed to serialize tag and digest as query parameters—they're part of VersionDetailsTabPathParams and the route helper explicitly handles them (lines 102–118 in RouteDefinitions.ts). OverviewCards bypasses this design and manually serializes them afterward. Pass tag and digest in the options object instead, or use React Router v5's cleaner location descriptor pattern ({ pathname, search }) to separate path and query concerns.

  2. Inefficiency: queryParams.toString() is called twice—once in the condition (line 100) and once in the template (line 101). Cache it.

♻️ Proposed refactor (location descriptor approach)
-    // Build query params to preserve both tag and digest
-    const queryParams = new URLSearchParams()
-    if (tag) queryParams.append('tag', tag)
-    if (digest) queryParams.append('digest', digest)
-
-    if (queryParams.toString()) {
-      url = `${url}?${queryParams.toString()}`
-    }
-
-    history.push(url)
+    // Build query params to preserve both tag and digest
+    const queryParams = new URLSearchParams()
+    if (tag) queryParams.append('tag', tag)
+    if (digest) queryParams.append('digest', digest)
+
+    const queryString = queryParams.toString()
+    history.push(queryString ? { pathname: url, search: `?${queryString}` } : url)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/src/ar/pages/version-details/components/OverviewCards/OverviewCards.tsx`
around lines 95 - 104, OverviewCards is manually appending tag/digest to the URL
and calling history.push(url) instead of using the route helper that already
knows how to serialize VersionDetailsTabPathParams; update the navigation to
either call routes.toARVersionDetailsTab(id, { tab: activeTab, tag, digest }) so
the helper emits the query params, or call history.push({ pathname:
routes.toARVersionDetailsTab(id, { tab: activeTab }), search: cachedSearch })
where you build and cache the query string once (const cachedSearch =
queryParams.toString()) before the if-check; ensure you stop calling
queryParams.toString() twice and remove the manual string interpolation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@web/src/ar/pages/version-details/components/OverviewCards/OverviewCards.tsx`:
- Around line 95-104: OverviewCards is manually appending tag/digest to the URL
and calling history.push(url) instead of using the route helper that already
knows how to serialize VersionDetailsTabPathParams; update the navigation to
either call routes.toARVersionDetailsTab(id, { tab: activeTab, tag, digest }) so
the helper emits the query params, or call history.push({ pathname:
routes.toARVersionDetailsTab(id, { tab: activeTab }), search: cachedSearch })
where you build and cache the query string once (const cachedSearch =
queryParams.toString()) before the if-check; ensure you stop calling
queryParams.toString() twice and remove the manual string interpolation.

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.

2 participants