mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 11:10:42 +00:00
fix(client): silence noisy LangSelector not found console warning (#4021)
## Description: Silence noisy console warnings of `LangSelector not found in DOM` on page hydration. Previously, `translateText()` queried the DOM very early in the client rendering/hydration phase before Lit Element had mounted the `<lang-selector>` element. This resulted in hundreds of noisy warnings in the browser developer console on page load. This fix resolves the issue gracefully in Utils.ts: it queries `getCachedLangSelector()` and immediately returns the key if not found without polluting the console log with warnings. Once the element is fully mounted, normal translation and cache updates resume. ## Please complete the following: - [X] I have added screenshots for all UI updates - [X] I process any text displayed to the user through translateText() and I've added it to the en.json file - [X] I have added relevant tests to the test directory - [X] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: barfires
This commit is contained in:
@@ -428,7 +428,6 @@ export const translateText = (
|
||||
|
||||
const langSelector = getCachedLangSelector();
|
||||
if (!langSelector) {
|
||||
console.warn("LangSelector not found in DOM");
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user