Skip to content

Commit

Permalink
fix: initial for multiple result
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikPham committed Jun 10, 2024
1 parent b0f23d1 commit 1b33aa2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export function createGoogleFontsFetch(defaultOptions: GoogleFontsFetchOptions):
extend(fontOptions, { css: { write: false, merge: false } })
}

let multipleResult: FetchFontsResult
let multipleResult: FetchFontsResult = []
try {
multipleResult = await context.multiple(multiple, fontOptions)
}
Expand All @@ -217,10 +217,14 @@ export function createGoogleFontsFetch(defaultOptions: GoogleFontsFetchOptions):
}
catch (e) {
errors.push(...chunkFamilies[i])
multipleResult = []
}
}

success.push(...multipleResult)
if (multipleResult.length > 0) {
success.push(...multipleResult)
}

if (baseOptions.chunk.delay) {
await delay(baseOptions.chunk.delay)
}
Expand Down

0 comments on commit 1b33aa2

Please sign in to comment.