fix: enable skills search filtering in dashboard (fixes #10)#21
Open
kagura-agent wants to merge 1 commit intoopen-gitagent:mainfrom
Open
fix: enable skills search filtering in dashboard (fixes #10)#21kagura-agent wants to merge 1 commit intoopen-gitagent:mainfrom
kagura-agent wants to merge 1 commit intoopen-gitagent:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.tsrewrites all URLs by concatenatingPROXY_BASE + url, wherePROXY_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:This buries the
qparameter inside thepathvalue. The browser'sURLSearchParamsseespath=/?q=dockeras a single param, sonuqscan never read back theqparameter fromlocation.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=allThe pathname is
encodeURIComponent-encoded so it's safely contained in thepathparam, while query params likeqbecome top-level params that:location.search(fixing the search UI state)pathand forwards remaining params)All URL rewriting call sites (
fetch,XHR,pushState,replaceState, link clicks, form submissions) now useproxyUrl()instead of raw concatenation.Testing
/→proxy?path=/(same as before)/?q=docker→proxy?path=%2F&q=dockersearchParams.get('path')returns the URL-decoded pathname ✅q=dockerto skills.sh ✅Fixes #10