File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -339,18 +339,22 @@ export function useSearch(
339339 const { intent, name } = parseSuggestionIntent ( q )
340340 let availability : { name : string ; available : boolean } | null = null
341341
342+ const promises : Promise < void > [ ] = [ ]
343+
342344 const trimmed = q . trim ( )
343345 if ( isValidNewPackageName ( trimmed ) ) {
344- checkPackageExists ( trimmed )
345- . then ( exists => {
346- if ( trimmed === toValue ( query ) . trim ( ) ) {
347- availability = { name : trimmed , available : ! exists }
348- packageAvailability . value = availability
349- }
350- } )
351- . catch ( ( ) => {
352- availability = null
353- } )
346+ promises . push (
347+ checkPackageExists ( trimmed )
348+ . then ( exists => {
349+ if ( trimmed === toValue ( query ) . trim ( ) ) {
350+ availability = { name : trimmed , available : ! exists }
351+ packageAvailability . value = availability
352+ }
353+ } )
354+ . catch ( ( ) => {
355+ availability = null
356+ } ) ,
357+ )
354358 } else {
355359 availability = null
356360 }
@@ -368,8 +372,6 @@ export function useSearch(
368372 const wantOrg = intent === 'org' || intent === 'both'
369373 const wantUser = intent === 'user' || intent === 'both'
370374
371- const promises : Promise < void > [ ] = [ ]
372-
373375 if ( wantOrg && existenceCache . value [ `org:${ lowerName } ` ] === undefined ) {
374376 promises . push (
375377 checkOrgNpm ( name )
You can’t perform that action at this time.
0 commit comments