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

RangeError: Maximum call stack size exceeded at deepExtend #2160

Closed
shalineepatel opened this issue Mar 13, 2024 · 2 comments
Closed

RangeError: Maximum call stack size exceeded at deepExtend #2160

shalineepatel opened this issue Mar 13, 2024 · 2 comments

Comments

@shalineepatel
Copy link

Hello,

We recently upgraded our project to react v18 and typescript v5. Also did upgrade i18next as well. And now getting this error at deepExtend.

Below are the versions we currently have.

"i18next": "^23.8.2"
"i18next-browser-languagedetector": "^7.2.0"
"react-i18next": "^14.0.5"

image

image

Here is the code:

const handleCurrentLanguage = async (currentLanguage: string) => {
sessionStorage.setItem("language", currentLanguage);
setCurrentLanguage(currentLanguage);
const translationKey = getLanguageByKey(currentLanguage).translationKey;
const fileName = getLanguageByKey(currentLanguage).fileName;
const res = await loadJson(fileName);
if (res) {
i18n.addResourceBundle(translationKey, "translation", res, true, true);
i18n.changeLanguage(translationKey, () => {
moment.locale(translationKey);
});
}
};

I tracked it happens at i18n.addResourceBundle. Is there any way we could fix it? Thanks in advance!

@adrai
Copy link
Member

adrai commented Mar 13, 2024

Please provide a reproducible example (codesandbox or repository)... not just code snippets

@shalineepatel
Copy link
Author

Figured the issue. It was happening because the json data was having nested default key. Fixed the way were importing the data and its not happening anymore. Closing the ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants