-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gatsby): correctly replace exported queries for StaticQuery (#11545)
- Loading branch information
Showing
8 changed files
with
103 additions
and
12 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
e2e-tests/production-runtime/cypress/integration/static-query/extraction.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
beforeEach(() => { | ||
cy.visit(`/`).waitForAPIorTimeout(`onRouteUpdate`) | ||
}) | ||
|
||
it(`replaces StaticQuery`, () => { | ||
cy.getTestElement(`bio`) | ||
.invoke(`text`) | ||
.should(`not.contain`, `Loading`) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react' | ||
import { StaticQuery, graphql } from 'gatsby' | ||
|
||
function Bio() { | ||
return ( | ||
<StaticQuery | ||
query={bioQuery} | ||
render={data => ( | ||
<div> | ||
<p data-testid="bio"> | ||
A site by {data.site.siteMetadata.author.name} who{` `} | ||
{data.site.siteMetadata.author.bio} | ||
</p> | ||
</div> | ||
)} | ||
/> | ||
) | ||
} | ||
|
||
export const bioQuery = graphql` | ||
{ | ||
site { | ||
siteMetadata { | ||
author { | ||
bio | ||
name | ||
} | ||
} | ||
} | ||
} | ||
` | ||
|
||
export default Bio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters