[PR #143] [MERGED] Fix script counter inconsistencies #234

Closed
opened 2026-02-26 12:40:42 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/community-scripts/ProxmoxVE-Local/pull/143
Author: @michelroegl-brunner
Created: 10/14/2025
Status: Merged
Merged: 10/14/2025
Merged by: @michelroegl-brunner

Base: mainHead: fix/counters


📝 Commits (1)

  • e82a832 fix: correct script counters to use deduplicated counts

📊 Changes

1 file changed (+31 additions, -4 deletions)

View changed files

📝 src/app/page.tsx (+31 -4)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/community-scripts/ProxmoxVE-Local/pull/143 **Author:** [@michelroegl-brunner](https://github.com/michelroegl-brunner) **Created:** 10/14/2025 **Status:** ✅ Merged **Merged:** 10/14/2025 **Merged by:** [@michelroegl-brunner](https://github.com/michelroegl-brunner) **Base:** `main` ← **Head:** `fix/counters` --- ### 📝 Commits (1) - [`e82a832`](https://github.com/community-scripts/ProxmoxVE-Local/commit/e82a832ba72319407d6756e9cba006be7bab549e) fix: correct script counters to use deduplicated counts ### 📊 Changes **1 file changed** (+31 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src/app/page.tsx` (+31 -4) </details> ### 📄 Description ## 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 - [x] Available Scripts counter now shows deduplicated count - [x] Downloaded Scripts counter now shows deduplicated count - [x] All counters match between tab headers and displayed content - [x] 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 12:40:42 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ProxmoxVE-Local#234
No description provided.