skillhub/web/src/shared/hooks
XiaoSeS 531d59caf2
feat(my-skills): add keyword search, namespace filter and clickable pagination (#493)
* feat(my-skills): add keyword search, namespace filter and clickable pagination

Add comprehensive filtering and search capabilities to the My Skills page:

- Keyword search: search by skill name, slug, or description
- Namespace filter: filter skills by namespace
- Clickable pagination: page number buttons with smart ellipsis
- State preservation: sync search state to URL, restore when returning from detail page
- Debounced search: 300ms debounce to avoid excessive queries
- Fix: hide stale rejected preview badge when newer version is published

Backend changes:
- MySkillAppService: add keyword and namespace filtering logic
- SkillLifecycleProjectionService: only show preview versions newer than published
- MeController: add keyword and namespace query parameters
- 6 new test cases covering search and filter scenarios

Frontend changes:
- my-skills.tsx: search input, namespace dropdown, URL state sync
- pagination.tsx: clickable page numbers with ellipsis
- use-user-queries.ts: prevent flicker on query transitions
- skill-detail.tsx: remove invalid rejected badge display
- router.tsx: URL parameter validation
- i18n: add search-related translation keys

Synced from SAAS commits:
- 939fa749 (feat: search and filters)
- dc14df6c (fix: search flicker)
- 0168ea81 (fix: rejected badge)
- c9eefa93 (fix: stale preview)

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(tests): address test failures in PR #493

Backend test fixes:
- Remove unnecessary Mockito stubbing for filtered-out skills
- Add missing findBySkillIdAndStatus stub for published version lookup
- Update MeController test mocks to match new method signature (keyword, namespace params)

Frontend fixes:
- Fix TypeScript error: useMyNamespaces returns ManagedNamespace[] not PagedResponse
- Add type annotation for namespace map callback parameter

E2E test fix:
- Update URL regex to allow query parameters (returnTo from search page)

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(tests): resolve test failures in PR #493

Backend:
- Remove unnecessary mock stubbings for skillId 2 and 3 in MySkillAppServiceTest.listMySkills_combinesKeywordNamespaceAndStatusFilters
- The test filters results to only return skill with id=1, so mocks for id 2 and 3 were never called, causing UnnecessaryStubbingException

Frontend:
- Add missing mocks for useLocation, useSearch, useMyNamespaces, and useDebounce in my-skills.test.ts
- MySkillsPage component uses these hooks but the test setup didn't provide mocks, causing 'No QueryClient set' and 'No export' errors

All 4 frontend tests now pass locally.

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

---------

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-06-05 17:24:51 +08:00
..
label-query.test.ts feat(notification): add in-app notifications and harden delivery 2026-03-23 12:31:28 +08:00
label-query.ts feat(notification): add in-app notifications and harden delivery 2026-03-23 12:31:28 +08:00
query-keys.test.ts test(web): add colocated frontend coverage 2026-03-23 16:13:34 +08:00
query-keys.ts refactor: address code review findings from 2026-03-22 2026-03-23 13:48:23 +08:00
skill-query-helpers.test.ts fix(search): preserve empty-query discovery results 2026-04-23 16:24:23 +08:00
skill-query-helpers.ts fix(search): preserve empty-query discovery results 2026-04-23 16:24:23 +08:00
use-debounce.test.ts test(web): add colocated frontend coverage 2026-03-23 16:13:34 +08:00
use-debounce.ts feat(web): add Phase 2 frontend foundation - types, hooks, shared and feature components 2026-03-12 02:43:01 +08:00
use-in-view.test.ts test(web): add colocated frontend coverage 2026-03-23 16:13:34 +08:00
use-in-view.ts fix: handle archived skill version deletion 2026-03-19 14:54:04 +08:00
use-label-queries.test.ts test(web): add colocated frontend coverage 2026-03-23 16:13:34 +08:00
use-label-queries.ts refactor: address code review findings from 2026-03-22 2026-03-23 13:48:23 +08:00
use-namespace-queries.test.ts test(web): add colocated frontend coverage 2026-03-23 16:13:34 +08:00
use-namespace-queries.ts Merge branch 'main' into fix/namespace-management-gaps 2026-05-09 15:13:44 +08:00
use-skill-queries.test.ts refactor: address code review findings from 2026-03-22 2026-03-23 13:48:23 +08:00
use-skill-queries.ts feat(skill): add version compare page with unified diff 2026-05-07 09:45:26 +08:00
use-user-queries.test.ts test(web): add colocated frontend coverage 2026-03-23 16:13:34 +08:00
use-user-queries.ts feat(my-skills): add keyword search, namespace filter and clickable pagination (#493) 2026-06-05 17:24:51 +08:00