Skip to content

Commit

Permalink
fix: regression lazy loading for file option (#1813)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon authored Jan 23, 2023
1 parent 5bd81af commit 041c170
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/runtime/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,19 @@ export async function loadLocale(
if (loaders != null) {
if (loaders.length === 1) {
const { key, load } = loaders[0]
if (!loadedMessages.has(key)) {
const message = await loadMessage(context, load)
let message: LocaleMessages<DefineLocaleMessage> | undefined | null = null
if (loadedMessages.has(key)) {
message = loadedMessages.get(key)
} else {
message = await loadMessage(context, load)
if (message != null) {
loadedMessages.set(key, message)
setter(locale, message)
loadedLocales.push(locale)
}
}
if (message != null) {
setter(locale, message)
loadedLocales.push(locale)
}
} else if (loaders.length > 1) {
const targetMessage: LocaleMessages<DefineLocaleMessage> = {}
for (const { key, load } of loaders) {
Expand Down

0 comments on commit 041c170

Please sign in to comment.