datocms / gatsby-source-datocms

Official GatsbyJS source plugin to pull content from DatoCMS
MIT License
140 stars 50 forks source link

Support react-helmet 6.0 #109

Closed winstonma closed 4 years ago

winstonma commented 4 years ago

I updated to the react-helmet 6.0 recently and got the following error in the browser.

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of HelmetDatoCms.

I got no problem after downgrading the react-helmet back to 5.2.1.

Just wanna add some reference: react-helmet upgrade from 5 to 6

Thanks for checking

wildpow commented 4 years ago

Upgraded react-helment to 6.0 from 5.2.1 and got this error. When I downgrade react-helmet project builds without errors. I figure this is has something to do with the data plug-in because I have a simular Gatsby project without this plug-in and it builds just fine.

  18 |   bodyComponent
  19 | }) => {
> 20 |   bodyHTML = (0, _server.renderToString)(bodyComponent);
     |                                          ^
  21 | };
  22 | 
  23 | exports.replaceRenderer = replaceRenderer;

  WebpackError: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undef  ined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warn  ings.

  - gatsby-ssr.js:20 Object.replaceRenderer
    node_modules/gatsby-plugin-linaria/gatsby-ssr.js:20:42
winstonma commented 4 years ago

@wildpow Did you use HelmetDatoCms in the project you mentioned?

I guess the problem arise only if you use SEO feature.

Figumari commented 4 years ago

I got the same error after using HelmetDatoCms in my project and upgrading the react-helmet from 5.2.0 to 6.0.0. Downgrading react-helmet solves the problem.

wildpow commented 4 years ago

@winstonma The project I got the error in is using HelmetDatoCms and I get the same result as @Figumari when I downgrade React-Helmet to 5.2.1 fro 6.0.