Skip to content

Conversation

michelroegl-brunner
Copy link
Member

Problem

The script counters in the tab headers don't match the actual counts displayed in the UI:

  • Available Scripts tab: Shows 408 in header, but CategorySidebar shows 403/394
  • Downloaded Scripts tab: Shows 395 in header, but CategorySidebar shows 394

Root Cause

The main page.tsx counter logic doesn't deduplicate scripts, while the individual tab components do. This creates confusion for users who see different numbers in the tab headers versus the content areas.

Solution

Changes Made

  1. Fixed Available Scripts Counter (src/app/page.tsx lines 73-88):

    • Now deduplicates scripts using Map by slug before counting
    • Matches the logic used in ScriptsGrid.tsx
    • Will show 403 instead of 408 (removing 5 duplicates)
  2. Fixed Downloaded Scripts Counter (src/app/page.tsx lines 90-117):

    • First deduplicates GitHub scripts using Map by slug
    • Then filters for scripts that have local versions
    • Matches the logic used in DownloadedScriptsTab.tsx
    • Will show consistent count with CategorySidebar

Deduplication Logic

  • Use slug as the unique identifier
  • Filter out scripts without valid name/slug
  • Use a Map to store only the first occurrence of each slug

Result

  • Tab header counters now match the actual displayed content
  • Eliminates user confusion from inconsistent numbers
  • All counters use the same deduplication logic across components

Testing

  • Available Scripts counter now shows deduplicated count
  • Downloaded Scripts counter now shows deduplicated count
  • All counters match between tab headers and displayed content
  • No linting errors introduced

Fixes the counter discrepancies shown in the UI where users see different numbers in tab headers versus the actual content areas.

- Update available scripts counter to deduplicate by slug using Map
- Update downloaded scripts counter to use deduplicated GitHub scripts
- Ensures tab header counts match CategorySidebar counts
- Fixes inconsistency where tab headers showed different numbers than displayed content

Resolves counter discrepancies:
- Available Scripts: now shows deduplicated count (403) instead of raw count (408)
- Downloaded Scripts: now shows deduplicated count matching sidebar display
@michelroegl-brunner michelroegl-brunner requested a review from a team as a code owner October 14, 2025 07:47
@michelroegl-brunner michelroegl-brunner linked an issue Oct 14, 2025 that may be closed by this pull request
@michelroegl-brunner michelroegl-brunner merged commit 8efff60 into main Oct 14, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Script counts are not plausible

1 participant