Commit 45f80409 authored by Joe Haddad's avatar Joe Haddad Committed by Tim Neutkens

Remove duplicated client code (#7907)

parent 47160fb0
......@@ -190,6 +190,8 @@ export async function render (props) {
export async function renderError (props) {
const { App, err } = props
// In development runtime errors are caught by react-error-overlay
// In production we catch runtime errors using componentDidCatch which will trigger renderError
if (process.env.NODE_ENV !== 'production') {
return webpackHMR.reportRuntimeError(webpackHMR.prepareError(err))
}
......@@ -277,23 +279,13 @@ async function doRender ({ App, Component, props, err }) {
appProps
})
// In development runtime errors are caught by react-error-overlay
if (process.env.NODE_ENV === 'development') {
renderReactElement(
<AppContainer>
<App {...appProps} />
</AppContainer>,
appElement
)
} else {
// In production we catch runtime errors using componentDidCatch which will trigger renderError
renderReactElement(
<AppContainer>
<App {...appProps} />
</AppContainer>,
appElement
)
}
// We catch runtime errors using componentDidCatch which will trigger renderError
renderReactElement(
<AppContainer>
<App {...appProps} />
</AppContainer>,
appElement
)
emitter.emit('after-reactdom-render', { Component, ErrorComponent, appProps })
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment