Fix react-intl missing translation error (#882)
* Improve error handling * Remove unused import
This commit is contained in:
parent
09625eb486
commit
f97ddd0128
1 changed files with 2 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
import useLocalStorage from "@saleor/hooks/useLocalStorage";
|
||||
import React from "react";
|
||||
import { IntlProvider, MissingTranslationError } from "react-intl";
|
||||
import { IntlProvider, ReactIntlErrorCode } from "react-intl";
|
||||
|
||||
export enum Locale {
|
||||
AR = "ar",
|
||||
|
@ -165,7 +165,7 @@ const LocaleProvider: React.FC = ({ children }) => {
|
|||
locale={locale}
|
||||
messages={getKeyValueJson(messages)}
|
||||
onError={err => {
|
||||
if (!(err instanceof MissingTranslationError)) {
|
||||
if (!(err.code === ReactIntlErrorCode.MISSING_TRANSLATION)) {
|
||||
console.error(err);
|
||||
}
|
||||
}}
|
||||
|
|
Loading…
Reference in a new issue