Dealing with some serious issues regarding dev/build mismatch in gatsby and finally found the reason fo rit. It revolves around wrapRootElement
and replaceComponentRenderer
being treated differently during the hydration process.
Look what happens when you return this:
gatsby-ssr.js
export const wrapRootElement = () => {
return <div className="wrapper">text</div>
}