Skip to content

refactor(skills): unify flat layout, toolbar, and header refresh across Skills tabs - #10050

Merged
farion1231 merged 4 commits into
farion1231:mainfrom
allenxu09:refactor/unify-skills-ui
Dec 1, 2026
Merged

farion1231 merged 4 commits into
farion1231:mainfrom
allenxu09:refactor/unify-skills-ui

Conversation

@allenxu09

Copy link
Copy Markdown
Collaborator

Summary

Unifies the Skills page layout so all tabs share the same calm, flat structure and align with the MCP and Plugins pages:

  1. Flat 3-tab navigation (Installed / Repositories / skills.sh): Removes the nested Repos | skills.sh segmented control inside the Discover card header and matches the 3-tab structure of the Plugins page. Keeps PageTabs purely for navigation (removes createPortal search injection).
  2. Unified header refresh / check-updates action: Moves Check for updates / Refresh repos / Refresh into a single consistent slot in AppPageHeader (left of + Add Skill), matching PluginsPage.
  3. Unified h-14 flat toolbar across all tabs:
    • Fixed 320px left-aligned search input (MatrixSearch), matching MCP & Plugins — zero horizontal jumping when switching tabs.
    • Single quiet Filter popover (InstalledFilterMenu / ReposFilterPopover) that consolidates Status, Source, Only-uninstalled, and repo toggles, with dismissible chips only when a filter is active.
    • Consistent item count next to the filter and right-aligned contextual action (Update all (N) when updates exist, or Install to on Repositories / skills.sh).
  4. Pure flat list cards: Removes the filter bar from inside the Discover card header so the card top edge stays aligned across all tabs.

Screenshots

Installed

Skills - Installed

Repositories

Skills - Repositories

skills.sh

Skills - skills.sh

Verification

  • pnpm typecheck passed
  • pnpm test:unit tests/components/UnifiedSkillsPanel.test.tsx tests/components/SkillsPageInstall.test.tsx (48/48 tests passed)
  • prettier formatted all modified files

@github-actions github-actions Bot added frontend Frontend (React/TypeScript) i18n Internationalization (zh/en/ja) skills Related to Skills management labels Nov 27, 2026

@farion1231 farion1231 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for this, the three tabs read much more consistently now. I checked the filters, repo toggles, "Install to", "Update all (N)" and the bulk actions against main and they're all still there, and each tab keeps its own state. Three regressions I could reproduce before this lands:

  1. Refresh on skills.sh empties the results. The new header Refresh reuses the retry handler, which clears the accumulated list and refetches. When skills.sh returns the same data, TanStack Query keeps the same data reference, so the effect that fills the list never re-runs and you get the "no results" message. A test with real TanStack Query and identical responses shows two requests and an empty list. After "Load more", Refresh also just drops back to page one without refetching for 5 minutes.

  2. Opening the Skills page now downloads every enabled repo. UnifiedSkillsPanel calls useDiscoverableSkills() and useSkillRepos() at the top level only to drive the header spinner. That query refetches on its first mount after each launch, and the backend repo cache only lives in memory for 10 minutes, so the first visit to Skills after each start pulls every repo from GitHub, even when you only look at Installed. Main mounts it lazily on purpose. Subscribing with useIsFetching on that query key, plus useRefreshDiscoverableSkills for the action, would keep the spinner without mounting the query.

  3. Selecting rows on Installed hides the search box, the Filter button and the chips. Selection survives search changes, so on main you can select A, change the search, select B and bulk-enable both. Here that no longer works, and while rows are selected there's no sign that a search or filter is active. The assertion in the old test that the Filter button stays visible during selection was removed in this PR.

Smaller things, no need to block on them:

  • While rows are selected, the "Updating N/M" progress no longer shows during a bulk update, because the selection branch is checked first. Fixing 3 at the same place covers it.
  • The fallback that opened skills.sh when no repo is configured is gone. Users with zero repos now land on an empty Repositories view that says the repos couldn't be read.
  • The fixed h-14 toolbar dropped the wrap. With a narrow window, two chips, the count and "Update all" can overlap.
  • skillsPage.viewDiscover, discover.sourceRepos, discover.sourceAria, repos.buttonAll and filter.sourceButton are now unused in all eight locales. localeParity doesn't catch dead keys like these.
  • {{count}} Skills has no plural form, so English shows "1 Skills".

@allenxu09

Copy link
Copy Markdown
Collaborator Author

Thanks for the thorough review! All three regressions and the smaller items have been fixed:

  1. skills.sh Refresh no longer empties results or skips refetch after Load more:
    • Added dataUpdatedAt to the useSearchSkillsSh accumulation effect so structurally identical responses still update state.
    • Separated header Refresh (refreshSkillsSh) from error Retry (retrySkillsSh): page-0 refresh no longer clears accumulated before refetching, and refreshing from offset > 0 resets to page 0 and forces a refetch() instead of serving the 5-minute stale cache.
  2. Lazy repo discovery restored:
    • Removed useDiscoverableSkills() and useSkillRepos() from UnifiedSkillsPanel top level, replacing them with useIsFetchingDiscoverableSkills() (useIsFetching) and useRefreshSkillRepos() (queryClient.refetchQueries). Opening Skills on the Installed tab no longer triggers repo downloads.
  3. Search, Filter, chips, and update progress stay visible during selection:
    • Kept MatrixSearch, InstalledFilterMenu, active filter chips, and the count visible on the left of the Installed toolbar while rows are selected, and prioritized updateProgress above selectionActive on the right.
  4. Smaller items:
    • Switched toolbars to min-h-14 flex-wrap py-2 so narrow windows wrap cleanly without overlap.
    • Added a dedicated empty-repositories state (skills.repo.empty) with direct Manage repositories and skills.sh actions when zero repos are configured.
    • Removed the 5 unused locale keys (viewDiscover, discover.sourceRepos, discover.sourceAria, repos.buttonAll, filter.sourceButton) across all 8 locales and added singular skillsPage.countOne (1 Skill / {{count}} Skills).
    • Added regression tests covering all three fixes (pnpm typecheck + 102/102 unit & locale parity tests passing).

@farion1231 farion1231 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for the quick turnaround. I rechecked everything from the last round and it's all fixed: Refresh on skills.sh keeps the results, the header no longer mounts the discovery query (Installed now shows zero mounts), search and filters stay visible while rows are selected, bulk-update progress is back, the zero-repo empty state works, the toolbars wrap, and the dead keys are gone.

One new regression came from the refresh fix:

After "Load more", a background refetch of the same page appends it again. The effect that fills the list now also depends on the data's update time, so when TanStack Query refetches a page on window focus or reconnect after the 5-minute stale time and gets the same data back, the effect runs again and appends that page a second time. In a test with real TanStack Query, the page-2 row shows up twice with this head and once with the previous SkillsPage. "Load more" can also disappear early. The skills.sh tab stays mounted after you switch away, so this can happen while you're on another tab. Deduplicating by key when appending, or appending only when the page number changes and replacing the page on a same-page refetch, would fix it.

Minor: Russian 2–4 should use «навыка», but it currently shows «2 навыков». Not worth blocking on.

@allenxu09

Copy link
Copy Markdown
Collaborator Author

Good catch — fixed both:

  • Same-page background refetch no longer duplicates rows: Stored skills.sh pages in a Map<offset, skills> and merged/deduplicated by key in offset order, so a background refetch of an already-loaded page replaces that page in place instead of appending it again (and keeps "Load more" accurate). Added a regression test in tests/components/SkillsPageInstall.test.tsx.
  • Russian count: Switched skillsPage.count / skillsPage.countOne in ru.json to "Навыков: {{count}}" to match skills.count, mcpPage.count, and pluginsPage.count (works cleanly for 1, 2–4, and 5+).

funkpopo
funkpopo previously approved these changes Nov 27, 2026
@allenxu09
allenxu09 requested a review from farion1231 December 1, 2026 04:24
# Conflicts:
#	src/components/skills/SkillsPage.tsx
#	src/hooks/useSkills.ts
@farion1231

Copy link
Copy Markdown
Owner

Thanks @allenxu09! The three Skills tabs now line up with the MCP and Plugins pages, and every issue from the earlier rounds got fixed quickly and with regression tests. #10061 landed first and conflicted with this branch, so I pushed a merge commit on top: the branch column in the new repo filter popover now uses displayRepoBranch, so it keeps showing the resolved HEAD branch from #10061. Typecheck, knip and the full frontend suite pass on the merged tree. Merging now.

@farion1231
farion1231 merged commit 5637b12 into farion1231:main Dec 1, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Frontend (React/TypeScript) i18n Internationalization (zh/en/ja) skills Related to Skills management

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants