Revert "Add Intl to off-SPA rendering"

This commit is contained in:
Vesa Luusua 2018-08-01 23:37:18 +03:00 committed by GitHub
parent 32c8c73109
commit 7e79fe3dc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 22 deletions

View file

@ -11,9 +11,6 @@ way to update this template, but currently, we follow a pattern:
* Patch (v0.0.**X**): Bug fixes and small changes to components.
---
## v1.3.1
* [fix] Add Intl to off-SPA rendering
[#879](https://github.com/sharetribe/flex-template-web/pull/879)
## v1.3.0
* [change] Reusable SearchMap.

View file

@ -1,6 +1,6 @@
{
"name": "app",
"version": "1.3.1",
"version": "1.3.0",
"private": true,
"license": "Apache-2.0",
"dependencies": {

View file

@ -1,19 +1,8 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { node, string } from 'prop-types';
import { IntlProvider } from 'react-intl';
import mapValues from 'lodash/mapValues';
import config from '../../config';
import messages from '../../translations/en.json';
import css from './SearchMap.css';
// Locale should not affect the tests. We ensure this by providing
// messages with the key as the value of each message.
const testMessages = mapValues(messages, (val, key) => key);
const isTestEnv = process.env.NODE_ENV === 'test';
const localeMessages = isTestEnv ? testMessages : messages;
class ReusableMapContainer extends React.Component {
constructor(props) {
super(props);
@ -53,7 +42,6 @@ class ReusableMapContainer extends React.Component {
renderSearchMap() {
const targetDomNode = document.getElementById(this.el.id);
let renderContent = this.props.children;
// Check if we have already added map somewhere on the DOM
if (!targetDomNode) {
@ -63,11 +51,6 @@ class ReusableMapContainer extends React.Component {
} else if (!this.mountNode) {
// if no mountNode is found, append this outside SPA rendering tree (to document body)
document.body.appendChild(this.el);
renderContent = (
<IntlProvider locale={config.locale} messages={localeMessages}>
{this.props.children}
</IntlProvider>
);
}
} else {
this.el.classList.remove(css.reusableMapHidden);
@ -79,7 +62,8 @@ class ReusableMapContainer extends React.Component {
this.mountNode.appendChild(this.el);
}
}
ReactDOM.render(renderContent, this.el);
ReactDOM.render(this.props.children, this.el);
}
render() {