Skip to content

Commit

Permalink
Merge branch 'fix-components-missing-props' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
tgallacher committed Sep 2, 2019
2 parents 78deb56 + 36289f0 commit 6c0937e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions __tests__/gatsby-ssr.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ it('removes the generator <meta> tag', () => {
let result;
// mock component objects
const initialHeadComponents = [
{ type: 'meta' }, // no props
{ type: 'link', props: { href: '/#' } },
{
type: 'meta',
Expand Down Expand Up @@ -73,6 +74,7 @@ it('removes the version string from the generator <meta> tag', () => {
};
// mock component objects
const initialHeadComponents = [
{ type: 'meta' }, // no props
{ type: 'link', props: { href: '/#' } },
{
type: 'meta',
Expand Down
4 changes: 2 additions & 2 deletions src/gatsby-ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ exports.onPreRenderHTML = (
const keepTag = removeVersionOnly || content != undefined;
const headComponents = getHeadComponents()
.map(c =>
isGeneratorTag(c.type, c.props.name)
isGeneratorTag(c.type, c.props ? c.props.name : '')
? Object.assign({}, c, {
props: Object.assign({}, c.props, { content: content || 'Gatsby' }),
})
: c,
)
.filter(({ type, props: { name, content } }) =>
.filter(({ type, props: { name, content } = {} }) =>
keepTag ? true : !isGeneratorTag(type, name),
);

Expand Down

0 comments on commit 6c0937e

Please sign in to comment.