Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use take instead of first to prevent EmptyError on missing translation #1554

Merged
merged 1 commit into from Dec 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -9,7 +9,7 @@ import {
} from '@ngx-translate/core';
import { memoize } from 'lodash-es';
import { EMPTY, concat, defer, iif, of } from 'rxjs';
import { filter, first, map, tap } from 'rxjs/operators';
import { filter, map, take, tap } from 'rxjs/operators';

import { getSpecificServerTranslation, loadSingleServerTranslation } from 'ish-core/store/core/configuration';
import { InjectSingle } from 'ish-core/utils/injection';
Expand Down Expand Up @@ -46,7 +46,7 @@ export class FallbackMissingTranslationHandler implements MissingTranslationHand
}),
filter(translation => translation !== undefined),
map((translation: string) => this.translateCompiler.compile(translation, lang)),
first()
take(1)
)
);
}
Expand All @@ -60,7 +60,7 @@ export class FallbackMissingTranslationHandler implements MissingTranslationHand
this.reportMissingTranslation(lang, key);
}
}),
first()
take(1)
);
}

Expand Down Expand Up @@ -93,7 +93,7 @@ export class FallbackMissingTranslationHandler implements MissingTranslationHand
).pipe(
// stop after first emission
whenTruthy(),
first(),
take(1),
map(translation => this.translateParser.interpolate(translation, params.interpolateParams)),
map(translation => (PRODUCTION_MODE ? translation : `TRANSLATE_ME ${translation}`))
);
Expand Down