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

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'resetAll') #31

Closed
kurtextrem opened this issue Nov 21, 2021 · 2 comments

Comments

@kurtextrem
Copy link
Contributor

kurtextrem commented Nov 21, 2021

I tested Edge Stable & Chrome Dev, and I can't get the website to work. It looks like this:
image

localStorage language entry is: "{"language":"de","locale":null}"

The error is triggered here:

return this.translations[key];

right after this is called:

SVGcode/src/js/i18n.js

Lines 55 to 62 in f6f00b1

async getTranslations() {
const { language, locale } = this.currentLanguageAndLocale;
this.translations = (
await import(`../i18n/${language}${locale ? `-${locale}` : ''}.js`).catch(
() => import(`../i18n/${this.defaultLocale}.js`),
)
).default;
}

I'm not sure what the issue is, because if I call the loader fn manually (with '../i18n/de.js') my promise resolves correctly to a Module. But since de.js is empty... reading .default on it doesn't work?

kurtextrem added a commit to kurtextrem/SVGcode that referenced this issue Nov 21, 2021
fixes the symptoms of tomayac#31
@kurtextrem
Copy link
Contributor Author

Two options: We wrap the line in a try ... catch or we make sure there are no i18n files that are empty in the future. What do you think?

@tomayac
Copy link
Owner

tomayac commented Nov 22, 2021

@tomayac tomayac closed this as completed Nov 22, 2021
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