Skip to content

Commit 210aefb

Browse files
committed
fix: do not ask for translations infinetely
1 parent e865c87 commit 210aefb

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

cmp/compiler/src/react/shared/LingoProvider.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,21 @@ function LingoProvider__Dev({
349349
`Fetched translations for ${hashesToFetch.length} hashes:`,
350350
newTranslations,
351351
);
352+
353+
const receivedHashes = new Set(Object.keys(newTranslations));
354+
const missingHashes = hashesToFetch.filter(
355+
(hash) => !receivedHashes.has(hash),
356+
);
357+
358+
if (missingHashes.length > 0) {
359+
logger.warn(
360+
`Server did not return translations for ${missingHashes.length} hashes: ${missingHashes.join(", ")}`,
361+
);
362+
for (const hash of missingHashes) {
363+
erroredHashesRef.current.add(hash);
364+
}
365+
}
366+
352367
setTranslations((prev) => ({ ...prev, ...newTranslations }));
353368
for (const hash of hashesToFetch) {
354369
registeredHashesRef.current.add(hash);

cmp/compiler/src/translation-server/translation-server.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,6 @@ export class TranslationServer {
700700
this.startTranslationActivity();
701701

702702
try {
703-
// Translate using the stored service
704703
const result = await this.translationService.translate(
705704
parsedLocale,
706705
this.metadata,

0 commit comments

Comments
 (0)