Verified Commit 71b9ae6f authored by Sandro Lutz's avatar Sandro Lutz
Browse files

Add workaround for production build

parent ee01f2e6
......@@ -5,6 +5,7 @@
*/
import React from 'react'
import ReactDOM from 'react-dom'
import PropTypes from 'prop-types'
import { ThemeProvider } from './src/context/themeContext'
......@@ -42,4 +43,22 @@ wrapRootElement.propTypes = {
element: PropTypes.node.isRequired,
}
export { wrapRootElement, shouldUpdateScroll }
/**
* This is a workaround for an issue with React hydration used by Gatsby.
*
* The main cause for this issue is a mismatch in rendering between
* first (server-side) and second (client-side) rendering of some components.
* For some components, React hydrate has problems to replace the attibutes
* correctly.
*
* See issue https://github.com/gatsbyjs/gatsby/issues/17914
*
* TODO: fix issue and remove workaround
*/
const replaceHydrateFunction = () => {
return (element, container, callback) => {
ReactDOM.render(element, container, callback)
}
}
export { replaceHydrateFunction, wrapRootElement, shouldUpdateScroll }
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