Skip to content

Commit

Permalink
Add config to toggle StrictMode (#7035)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean authored and willdurand committed Nov 24, 2018
1 parent dfc20fd commit 51004e7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/default-disco.js
Expand Up @@ -23,6 +23,7 @@ module.exports = {
'discoParamsToUse',
'enableDevTools',
'enableRequestID',
'enableStrictMode',
'experiments',
'hctEnabled',
'hrefLangsMap',
Expand Down
3 changes: 3 additions & 0 deletions config/default.js
Expand Up @@ -50,6 +50,8 @@ module.exports = {
// If true node will serve the static files.
enableNodeStatics: false,

enableStrictMode: true,

isDeployed: true,
isDevelopment: false,

Expand Down Expand Up @@ -112,6 +114,7 @@ module.exports = {
'enableFeatureHomeHeroGuides',
'enableFeatureStaticThemesForAndroid',
'enableRequestID',
'enableStrictMode',
'experiments',
'fxaConfig',
'hctEnabled',
Expand Down
17 changes: 15 additions & 2 deletions src/core/components/Root/index.js
Expand Up @@ -3,27 +3,40 @@ import * as React from 'react';
import { ConnectedRouter } from 'connected-react-router';
import { CookiesProvider, Cookies } from 'react-cookie';
import { Provider } from 'react-redux';
import config from 'config';

import I18nProvider from 'core/i18n/Provider';
import type { I18nType } from 'core/types/i18n';
import type { ReduxStore } from 'core/types/redux';
import type { ReactRouterHistoryType } from 'core/types/router';

type Props = {|
_config?: typeof config,
children: React.Node,
cookies?: typeof Cookies,
history: ReactRouterHistoryType,
i18n: I18nType,
store: ReduxStore,
|};

const Root = ({ children, history, i18n, store, cookies = null }: Props) => (
const Root = ({
_config = config,
children,
history,
i18n,
store,
cookies = null,
}: Props) => (
<I18nProvider i18n={i18n}>
<Provider store={store} key="provider">
<ConnectedRouter history={history}>
<CookiesProvider cookies={cookies}>
{/* $FLOW_FIXME: https://github.com/facebook/react/issues/12553 */}
<React.StrictMode>{children}</React.StrictMode>
{_config.get('enableStrictMode') ? (
<React.StrictMode>{children}</React.StrictMode>
) : (
children
)}
</CookiesProvider>
</ConnectedRouter>
</Provider>
Expand Down

0 comments on commit 51004e7

Please sign in to comment.