Skip to content

fix: enable skills search filtering in dashboard (fixes #10)#21

Open
kagura-agent wants to merge 1 commit intoopen-gitagent:mainfrom
kagura-agent:fix/10-search-in-skills-section-is-no
Open

fix: enable skills search filtering in dashboard (fixes #10)#21
kagura-agent wants to merge 1 commit intoopen-gitagent:mainfrom
kagura-agent:fix/10-search-in-skills-section-is-no

Conversation

@kagura-agent
Copy link

Problem

The search functionality in the Skills section (proxied from skills.sh) was broken. Typing in the search input field did not filter skills — the list remained unchanged.

Root Cause

The skills marketplace proxy in server.ts rewrites all URLs by concatenating PROXY_BASE + url, where PROXY_BASE = '/api/skills-mp/proxy?path='.

When nuqs (the URL state management library used by skills.sh) updates the URL to add a search query — e.g., /?q=docker — the proxy interceptor rewrites it to:

/api/skills-mp/proxy?path=/?q=docker

This buries the q parameter inside the path value. The browser's URLSearchParams sees path=/?q=docker as a single param, so nuqs can never read back the q parameter from location.search, and the search state is effectively lost.

The same issue affects fetch, XMLHttpRequest, pushState, replaceState, link clicks, and form submissions.

Fix

Introduced a proxyUrl() helper that splits the raw URL into pathname and query string:

  • /?q=docker/api/skills-mp/proxy?path=%2F&q=docker
  • /official?q=test&view=all/api/skills-mp/proxy?path=%2Fofficial&q=test&view=all

The pathname is encodeURIComponent-encoded so it's safely contained in the path param, while query params like q become top-level params that:

  1. nuqs can read from location.search (fixing the search UI state)
  2. The server proxy can forward to skills.sh (the server already strips path and forwards remaining params)

All URL rewriting call sites (fetch, XHR, pushState, replaceState, link clicks, form submissions) now use proxyUrl() instead of raw concatenation.

Testing

  • Paths without query strings are unchanged: /proxy?path=/ (same as before)
  • Paths with query strings now correctly preserve params: /?q=dockerproxy?path=%2F&q=docker
  • Server-side searchParams.get('path') returns the URL-decoded pathname ✅
  • Server-side forwards q=docker to skills.sh ✅

Fixes #10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search in Skills section is not working

1 participant