We keep getting random error messages via Airbreak from our React app while using React Intl for localization.
Error message
Invariant Violation: [React Intl] Could not find required
intl
object. needs to exist in the component ancestry.
Our application is very small. We have three pages, where one page has multiple modal dialogs embedded and then possibly opened by the user. We have been unable to pinpoint this problem to an exact browser, version or point in code.
We have tried to dig in to the error message and find the exact cause with no luck. Modal dialogs exist as a child component to the main one and are embedded when the parent component is rendered.
Our main.js render is wrapped as such with IntlProvider:
render() {
return (
<ErrorBoundary>
<IntlProvider locale={language} messages={messages[language]}>
<Router>
<Route render={({location}) => (
<div id="site-container">
...
ErrorBoundary is Airbrake. IntlProvider gets the locale and translated strings.
Parent components have been injected with Intl:
Page.propTypes = {
intl: intlShape.isRequired
};
export default injectIntl(Page);
The IntlProvider usage is as the documentation describes it should be used but are we missing something here? What is the cause for this error? Some dialog is not getting the intl provided for it?
We should not be getting these errors. It appears to cause a total crash of any page load if it does.