Skip to content

fix(artists): readable active-tab badge + visible suggestions errors - #713

Merged
LucasSantana-Dev merged 1 commit into
mainfrom
fix/musical-taste-badge-and-error-surface
Apr 19, 2026
Merged

LucasSantana-Dev merged 1 commit into
mainfrom
fix/musical-taste-badge-and-error-surface

Conversation

@LucasSantana-Dev

@LucasSantana-Dev LucasSantana-Dev commented Apr 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Active tab's count badge now uses white background/text so the count is visible against the brand-colored button (was previously brand-on-brand → invisible).
  • loadSuggestions now stores the error and surfaces it with a Try again button; failures (503, 500, network) used to be silently shown as the generic "No suggestions available" empty state, leaving users with no path forward and ops with no signal.

Test plan

  • 24/24 frontend tests pass (2 new: badge contrast + error+retry flow)
  • Type check clean

Summary by CodeRabbit

Release Notes

  • New Features

    • When suggestion loading fails, users now see an error message with a "Try again" button to retry fetching
    • Improved tab badge styling for clearer visual distinction between active and inactive tabs
  • Bug Fixes

    • Enhanced error handling for failed suggestion fetches with user-friendly messaging
  • Tests

    • Added comprehensive test coverage for error scenarios and tab styling behavior

- Active tab's count badge now uses bg-white/20 + text-white so the
  number stays readable on the brand-colored button.
- loadSuggestions now stores the error message and renders it with a
  Try again button; previously every failure (503, 500, network) was
  silently masked as the generic "No suggestions available" empty
  state.
@vercel

vercel Bot commented Apr 19, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lucky Ready Ready Preview, Comment Apr 19, 2026 1:01am

Request Review

@coderabbitai

coderabbitai Bot commented Apr 19, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Enhanced error handling for suggestions fetching in PreferredArtists page by introducing error state management, displaying error messages with retry functionality, and updating tab badge styling with conditional active/inactive states.

Changes

Cohort / File(s) Summary
Error Handling & Recovery
packages/frontend/src/pages/PreferredArtists.tsx
Added suggestionsError state to capture API error messages; displays error banner when suggestions fail to load with a "Try again" button that retriggers the fetch; suppresses empty-state message when error is present.
Tab Badge Styling
packages/frontend/src/pages/PreferredArtists.tsx
Updated badge conditional classes to highlight active tab with bg-white/20 text-white styling and default styling for inactive tabs.
Error Handling Tests
packages/frontend/src/pages/PreferredArtists.test.tsx
Added test validating badge styling differences between active and inactive tabs; added test for error-handling flow including error display, retry button visibility, and recovery after retry.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested labels

frontend, size/m

🚥 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 directly and concisely summarizes the two main changes: improving active-tab badge readability and making suggestion errors visible to users.

✏️ 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 fix/musical-taste-badge-and-error-surface

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.

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

Actionable comments posted: 1

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

Inline comments:
In `@packages/frontend/src/pages/PreferredArtists.tsx`:
- Around line 560-576: The async suggestions error block should be announced to
assistive tech; wrap the error UI (the div that renders when !searching &&
!query.trim() && suggestionsError && !suggestionsLoading) in an accessible live
region by adding role="alert" and aria-atomic="true" to that container (or
alternatively add aria-live="assertive" and aria-atomic="true" to the paragraph
showing suggestionsError) so screen readers announce the message when
suggestionsError appears; keep the existing retry button (loadSuggestions)
as-is.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6b80ff84-f6ca-4391-9db5-eba0f6e43878

📥 Commits

Reviewing files that changed from the base of the PR and between 04990bb and 55c208e.

📒 Files selected for processing (2)
  • packages/frontend/src/pages/PreferredArtists.test.tsx
  • packages/frontend/src/pages/PreferredArtists.tsx
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Quality Gates
  • GitHub Check: SonarCloud Scan
🔇 Additional comments (5)
packages/frontend/src/pages/PreferredArtists.test.tsx (2)

752-775: Badge contrast regression coverage looks good.

This directly covers the active/inactive badge text-color behavior that motivated the visual fix.


777-801: Retry flow coverage looks good.

The test verifies the failure state, retry affordance, recovered suggestions rendering, and that the suggestions API is called again.

packages/frontend/src/pages/PreferredArtists.tsx (3)

14-14: Suggestions error state plumbing looks good.

The fetch path now clears stale errors before loading, empties stale suggestions on failure, and surfaces ApiError.message when available with a safe fallback.

Also applies to: 181-181, 214-230


447-454: Active badge styling fixes the contrast issue.

Using bg-white/20 text-white for the active tab badge avoids the previous brand-on-brand readability problem while preserving the inactive brand styling.


578-581: Empty state no longer masks fetch failures.

The additional !suggestionsError guard correctly keeps the generic empty state from replacing the actionable error + retry UI.

Comment thread packages/frontend/src/pages/PreferredArtists.tsx
@sonarqubecloud

Copy link
Copy Markdown

@LucasSantana-Dev
LucasSantana-Dev merged commit 17b2ed7 into main Apr 19, 2026
12 of 13 checks passed
LucasSantana-Dev added a commit that referenced this pull request May 13, 2026
…713)

- Active tab's count badge now uses bg-white/20 + text-white so the
  number stays readable on the brand-colored button.
- loadSuggestions now stores the error message and renders it with a
  Try again button; previously every failure (503, 500, network) was
  silently masked as the generic "No suggestions available" empty
  state.
@LucasSantana-Dev
LucasSantana-Dev deleted the fix/musical-taste-badge-and-error-surface branch May 23, 2026 02:21

This branch was successfully deployed

1 active deployment
Preview — 55c208e3 Deployed Apr 19, 2026 by vercel[bot]
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.

1 participant