Skip to content

Commit

Permalink
Fix gatsby-plugin-react-helmet for v6.0.0 (gatsbyjs#10578)
Browse files Browse the repository at this point in the history
## Description

In version 6.0.0 of react-helmet, the default export has been removed. There is now only a named export, e.g.

```
import { Helmet } from 'react-helmet';
```

In v5.x.x, both a default export and named are exported. Change is here:

nfl/react-helmet@20ea385#diff-cc54072daf5278847980b841520c8fffL287

This is a backwards compatible change. v5 has an annoying bug (nfl/react-helmet#373) which v6 seems to fix.
  • Loading branch information
Ehesp authored and DSchau committed Dec 20, 2018
1 parent 41ca9bb commit 99b57c1
Show file tree
Hide file tree
Showing 48 changed files with 57 additions and 56 deletions.
6 changes: 3 additions & 3 deletions docs/blog/2017-07-19-creating-a-blog-with-gatsby/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ We'll want to create the file `src/templates/blog-post.js` (please create the

```javascript:title=src/templates/blog-post.js
import React from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"

// import '../css/blog-post.css'; // make it pretty!

Expand Down Expand Up @@ -302,7 +302,7 @@ specified earlier.

```javascript:title=src/templates/blog-post.js
import React from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import { graphql } from "gatsby"

// import '../css/blog-post.css';
Expand Down Expand Up @@ -546,7 +546,7 @@ available within the browser and the statically generated site.
```javascript:title=src/pages/index.js
import React from "react"
import { Link, graphql } from "gatsby"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"

// import '../css/index.css'; // add some style if you want!

Expand Down
2 changes: 1 addition & 1 deletion docs/blog/2017-11-06-migrate-hugo-gatsby/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ that Gatsby delivers the HTML page at `/admin`.

```jsx
import React from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
const AdminPage = () => (
<div className="admin">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ First, we want to display the list of posts on the homepage. To do so, add the f
import React from "react"
import { Link } from "gatsby"
import get from "lodash/get"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"

import Bio from "../components/Bio"
import { rhythm } from "../utils/typography"
Expand Down Expand Up @@ -211,7 +211,7 @@ Create the template at `src/templates/blog-post.js`:

```javascript
import React from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import { Link } from "gatsby"
import get from "lodash/get"

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/add-seo-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Create a new component with this initial boilerplate:

```jsx:title=src/components/SEO.js
import React from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import PropTypes from "prop-types"
import { StaticQuery, graphql } from "gatsby"

Expand Down Expand Up @@ -124,7 +124,7 @@ The last step is to return this data with the help of `Helmet`. Your complete SE

```jsx:title=src/components/SEO.js
import React from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import PropTypes from "prop-types"
import { StaticQuery, graphql } from "gatsby"

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/adding-tags-and-categories-to-blog-posts.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ import PropTypes from "prop-types"
import kebabCase from "lodash/kebabCase"

// Components
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import { Link, graphql } from "gatsby"

const TagsPage = ({
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/authentication-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ And edit the layout component to include it:
```jsx:title=src/components/layout.js
import React from "react"
import PropTypes from "prop-types"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import { StaticQuery, graphql } from "gatsby"

import Header from "./header"
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/migrating-from-v1-to-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ Replacing a layout's query with `StaticQuery`:

```diff:title=src/components/layout.js
import React, { Fragment } from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
+ import { StaticQuery, graphql } from "gatsby"

- export default ({ children, data }) => (
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/gatsby-image/src/components/layout.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import PropTypes from 'prop-types'
import Helmet from 'react-helmet'
import { Helmet } from 'react-helmet'
import { StaticQuery, graphql } from 'gatsby'

import Header from './header'
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/path-prefix/src/components/layout.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import PropTypes from 'prop-types'
import Helmet from 'react-helmet'
import { Helmet } from 'react-helmet'
import { StaticQuery, graphql } from 'gatsby'

import Header from './header'
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/production-runtime/src/components/layout.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import PropTypes from 'prop-types'
import Helmet from 'react-helmet'
import { Helmet } from 'react-helmet'
import { StaticQuery, graphql } from 'gatsby'

import Header from './header'
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-auth/src/components/Layout/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"

import Header from "../Header"

Expand Down
2 changes: 1 addition & 1 deletion examples/using-cxs/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Fragment } from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import cxs from "cxs"

// Create a Title component that'll render an <h1> tag with some styles
Expand Down
2 changes: 1 addition & 1 deletion examples/using-emotion-prismjs/src/components/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { Fragment } from "react"
import { Link, StaticQuery, graphql } from "gatsby"
import PropTypes from "prop-types"
import { css } from "react-emotion"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"

import { rhythm } from "../utils/typography"
import "../prism-styles"
Expand Down
2 changes: 1 addition & 1 deletion examples/using-emotion/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Fragment } from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import styled from "@emotion/styled"
import { css, Global } from "@emotion/core"

Expand Down
2 changes: 1 addition & 1 deletion examples/using-faker/src/layouts/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react"
import PropTypes from "prop-types"
import { Link, graphql } from "gatsby"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"

import "./index.css"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import moment from "moment"

class HelmetBlock extends React.Component {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import "../../static/css/base.scss"

class MasterLayout extends React.Component {
Expand Down
2 changes: 1 addition & 1 deletion examples/using-jest/src/components/layout.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import PropTypes from 'prop-types'
import Helmet from 'react-helmet'
import { Helmet } from 'react-helmet'
import { StaticQuery, graphql } from 'gatsby'

import Header from './header'
Expand Down
2 changes: 1 addition & 1 deletion examples/using-mongodb/src/layouts/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import { Link } from "gatsby"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"

class DefaultLayout extends React.Component {
render() {
Expand Down
2 changes: 1 addition & 1 deletion examples/using-page-transitions/src/layouts/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import { Link } from "gatsby"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import Transition from "../components/transition"

import "./layout.css"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import styled from "styled-components"
import DynamicComponent from "../components/DynamicComponent"
import "./style.css"
Expand Down
2 changes: 1 addition & 1 deletion examples/using-redirects/src/components/layout.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react"
import PropTypes from "prop-types"
import { Link } from "gatsby"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"

import "./layout.css"
import "./selected.css"
Expand Down
2 changes: 1 addition & 1 deletion examples/using-remark-copy-linked-files/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react"
import { Link, graphql } from "gatsby"
import get from "lodash/get"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"

import Layout from "../components/layout"
import Bio from "../components/Bio"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import { graphql } from "gatsby"
import get from "lodash/get"

Expand Down
2 changes: 1 addition & 1 deletion examples/using-styled-components/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Fragment } from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import styled, { createGlobalStyle } from "styled-components"

const GlobalStyle = createGlobalStyle`
Expand Down
11 changes: 6 additions & 5 deletions packages/gatsby-plugin-react-helmet/src/gatsby-ssr.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"

exports.onRenderBody = (
{ setHeadComponents, setHtmlAttributes, setBodyAttributes },
pluginOptions
) => {
exports.onRenderBody = ({
setHeadComponents,
setHtmlAttributes,
setBodyAttributes,
}) => {
const helmet = Helmet.renderStatic()
// These action functions were added partway through the Gatsby 1.x cycle.
if (setHtmlAttributes) {
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/cache-dir/api-ssr-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ exports.replaceRenderer = true
* is merged with other body props and passed to `html.js` as `bodyProps`.
* @param {Object} pluginOptions
* @example
* const Helmet = require("react-helmet")
* const { Helmet } = require("react-helmet")
*
* exports.onRenderBody = (
* { setHeadComponents, setHtmlAttributes, setBodyAttributes },
Expand Down
2 changes: 1 addition & 1 deletion www/src/components/layout/layout-with-heading.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import PropTypes from "prop-types"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import { SkipNavLink } from "@reach/skip-nav"
import { OutboundLink } from "gatsby-plugin-google-analytics"
import styled from "react-emotion"
Expand Down
2 changes: 1 addition & 1 deletion www/src/components/package-readme.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import PropTypes from "prop-types"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"

import { Link } from "gatsby"
import { colors } from "../utils/presets"
Expand Down
2 changes: 1 addition & 1 deletion www/src/components/showcase-details.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Fragment } from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import url from "url"
import Img from "gatsby-image"
import qs from "qs"
Expand Down
2 changes: 1 addition & 1 deletion www/src/components/site-metadata.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import { graphql, StaticQuery } from "gatsby"

import gatsbyIcon from "../assets/gatsby-icon.png"
Expand Down
2 changes: 1 addition & 1 deletion www/src/pages/blog/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { graphql } from "gatsby"
import kebabCase from "lodash/kebabCase"

// Components
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import { Link } from "gatsby"
import Layout from "../../components/layout"
import Container from "../../components/container"
Expand Down
2 changes: 1 addition & 1 deletion www/src/pages/docs/actions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import { graphql } from "gatsby"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import sortBy from "lodash/sortBy"

import Functions from "../../components/function-list"
Expand Down
2 changes: 1 addition & 1 deletion www/src/pages/docs/browser-apis.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import { graphql } from "gatsby"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import sortBy from "lodash/sortBy"

import Functions from "../../components/function-list"
Expand Down
2 changes: 1 addition & 1 deletion www/src/pages/docs/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import { Link } from "gatsby"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"

import Layout from "../../components/layout"
import { itemListDocs } from "../../utils/sidebar/item-list"
Expand Down
2 changes: 1 addition & 1 deletion www/src/pages/docs/node-apis.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import { graphql } from "gatsby"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import sortBy from "lodash/sortBy"

import Functions from "../../components/function-list"
Expand Down
2 changes: 1 addition & 1 deletion www/src/pages/docs/ssr-apis.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import { graphql } from "gatsby"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import sortBy from "lodash/sortBy"

import Functions from "../../components/function-list"
Expand Down
2 changes: 1 addition & 1 deletion www/src/pages/features.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from "react"
import { graphql } from "gatsby"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"

import Layout from "../components/layout"
import EvaluationTable from "../components/evaluation-table"
Expand Down
2 changes: 1 addition & 1 deletion www/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import { graphql } from "gatsby"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import Layout from "../components/layout"
import presets, { colors } from "../utils/presets"
import { rhythm } from "../utils/typography"
Expand Down
2 changes: 1 addition & 1 deletion www/src/pages/newsletter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import { rhythm } from "../utils/typography"
import { colors } from "../utils/presets"

Expand Down
2 changes: 1 addition & 1 deletion www/src/templates/template-blog-list.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import { graphql } from "gatsby"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"

import Layout from "../components/layout"
import Container from "../components/container"
Expand Down
2 changes: 1 addition & 1 deletion www/src/templates/template-blog-post.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import { Link, graphql } from "gatsby"
import rehypeReact from "rehype-react"
import ArrowForwardIcon from "react-icons/lib/md/arrow-forward"
Expand Down
2 changes: 1 addition & 1 deletion www/src/templates/template-creator-details.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from "react"
import { graphql, Link } from "gatsby"
import Layout from "../components/layout"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import typography, { rhythm, scale, options } from "../utils/typography"
import Img from "gatsby-image"
import CreatorsHeader from "../views/creators/creators-header"
Expand Down
2 changes: 1 addition & 1 deletion www/src/templates/template-docs-markdown.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import Helmet from "react-helmet"
import { Helmet } from "react-helmet"
import { graphql } from "gatsby"

import Layout from "../components/layout"
Expand Down
Loading

0 comments on commit 99b57c1

Please sign in to comment.