File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,8 @@ export function useNpmSearch(
100100 size : opts . size ?? 25 ,
101101 } )
102102
103+ opts . onSuccess ?.( { query : q } )
104+
103105 if ( q !== toValue ( query ) ) {
104106 return emptySearchResponse
105107 }
@@ -131,6 +133,8 @@ export function useNpmSearch(
131133 } ) ,
132134 ] )
133135
136+ opts . onSuccess ?.( { query : q } )
137+
134138 if ( ! pkg ) {
135139 return emptySearchResponse
136140 }
@@ -166,6 +170,8 @@ export function useNpmSearch(
166170 60 ,
167171 )
168172
173+ opts . onSuccess ?.( { query : q } )
174+
169175 // If query changed/outdated, return empty search response
170176 if ( q !== toValue ( query ) ) {
171177 return emptySearchResponse
@@ -181,8 +187,6 @@ export function useNpmSearch(
181187 // Success - clear rate limit flag
182188 isRateLimited . value = false
183189
184- opts . onSuccess ?.( { query : q } )
185-
186190 return { ...response , isStale }
187191 } catch ( error : unknown ) {
188192 // Detect rate limit errors. npm's 429 response doesn't include CORS headers,
You can’t perform that action at this time.
0 commit comments