@@ -58,6 +58,7 @@ export function SkillsIndex() {
5858
5959 const trimmedQuery = useMemo ( ( ) => query . trim ( ) , [ query ] )
6060 const hasQuery = trimmedQuery . length > 0
61+ const searchKey = trimmedQuery ? `${ trimmedQuery } ::${ highlightedOnly ? '1' : '0' } ` : ''
6162
6263 const listPage = useQuery (
6364 api . skills . listPublicPage ,
@@ -88,14 +89,14 @@ export function SkillsIndex() {
8889 } , [ cursor , hasQuery , listPage ] )
8990
9091 useEffect ( ( ) => {
91- if ( ! hasQuery ) {
92+ if ( ! searchKey ) {
9293 setSearchResults ( [ ] )
9394 setIsSearching ( false )
9495 return
9596 }
9697 setSearchResults ( [ ] )
9798 setSearchLimit ( pageSize )
98- } , [ hasQuery , highlightedOnly , trimmedQuery ] )
99+ } , [ searchKey ] )
99100
100101 useEffect ( ( ) => {
101102 if ( ! hasQuery ) return
@@ -139,9 +140,7 @@ export function SkillsIndex() {
139140
140141 const filtered = useMemo (
141142 ( ) =>
142- baseItems . filter ( ( entry ) =>
143- highlightedOnly ? entry . skill . batch === 'highlighted' : true ,
144- ) ,
143+ baseItems . filter ( ( entry ) => ( highlightedOnly ? entry . skill . batch === 'highlighted' : true ) ) ,
145144 [ baseItems , highlightedOnly ] ,
146145 )
147146
@@ -173,9 +172,7 @@ export function SkillsIndex() {
173172 return results
174173 } , [ dir , filtered , sort ] )
175174
176- const isLoadingSkills = hasQuery
177- ? isSearching && searchResults . length === 0
178- : isLoadingList
175+ const isLoadingSkills = hasQuery ? isSearching && searchResults . length === 0 : isLoadingList
179176 const canLoadMore = hasQuery
180177 ? ! isSearching && searchResults . length === searchLimit && searchResults . length > 0
181178 : nextCursor !== null
@@ -318,7 +315,7 @@ export function SkillsIndex() {
318315 < div className = "card" >
319316 < div className = "loading-indicator" > Loading skills…</ div >
320317 </ div >
321- ) : showing === 0 ? (
318+ ) : sorted . length === 0 ? (
322319 < div className = "card" > No skills match that filter.</ div >
323320 ) : view === 'cards' ? (
324321 < div className = "grid" >
@@ -393,7 +390,11 @@ export function SkillsIndex() {
393390 style = { { marginTop : 16 , display : 'flex' , justifyContent : 'center' } }
394391 >
395392 { canAutoLoad ? (
396- isLoadingMore ? 'Loading more…' : 'Scroll to load more'
393+ isLoadingMore ? (
394+ 'Loading more…'
395+ ) : (
396+ 'Scroll to load more'
397+ )
397398 ) : (
398399 < button className = "btn" type = "button" onClick = { loadMore } disabled = { isLoadingMore } >
399400 { isLoadingMore ? 'Loading…' : 'Load more' }
0 commit comments