-
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.
feat(gatsby): Add preliminary fast-refresh integration (#26664)
* chore(gatsby): Use fast refresh if the version of react installed supports it * Update detect-hot-loader-to-use.ts * idk * rm * fix ts * try to fix 2 tests.. * things * fixes * another thing * Fix most tests * fix the tests by moving the page query into hook until i can fix the multiple exports problem * Finally got FastRefresh working with page components * fix tests * one versino of react * test something * fix test * revert script changes * reset react version for gatsby-cli * Update packages/gatsby/src/utils/get-react-hot-loader-strategy.ts Co-authored-by: Ward Peeters <[email protected]> * updates * named exports * circleci: create new test with fast-refresh * another position lel * update tests * reset package json * package.json * lock file * wip stuff from blaine * wip stuff from blaine * re-add pieh e2e tests * consolidate into less components and react class * lunch break -- use portal, runtime error works * use components * error boundary * runtime mostly working * lint * get babel-code-frame for runtime working * lint * fix errors from merge * Revert "re-add pieh e2e tests" This reverts commit 66c6400 * only use eval for fast-refresh * more proper TS types * re-add isomporphic-fetch * only conditionally use fast-refresh overlay + safe guards for sourceMap * style * test run for CI * cypress conditionally * comment out the default for 17 thing * fix linting * fix circleci after wrong merge conflict resolution Co-authored-by: Ward Peeters <[email protected]> Co-authored-by: LekoArts <[email protected]> Co-authored-by: gatsbybot <[email protected]> Co-authored-by: Michal Piechowiak <[email protected]>
- Loading branch information
1 parent
2e3ec89
commit 613f5c7
Showing
43 changed files
with
920 additions
and
92 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
"version": "1.0.0", | ||
"author": "Dustin Schau <[email protected]>", | ||
"dependencies": { | ||
"gatsby": "^2.4.4", | ||
"gatsby": "^2.27.1", | ||
"gatsby-image": "^2.0.41", | ||
"gatsby-plugin-image": "^0.0.2", | ||
"gatsby-plugin-manifest": "^2.0.17", | ||
|
@@ -18,8 +18,8 @@ | |
"gatsby-transformer-sharp": "^2.1.19", | ||
"isomorphic-fetch": "^2.2.1", | ||
"prop-types": "^15.6.2", | ||
"react": "16.8.6", | ||
"react-dom": "16.8.6", | ||
"react": "16.9.0", | ||
"react-dom": "16.9.0", | ||
"react-helmet": "^5.2.1" | ||
}, | ||
"keywords": [ | ||
|
@@ -30,6 +30,7 @@ | |
"scripts": { | ||
"build": "gatsby build", | ||
"develop": "cross-env CYPRESS_SUPPORT=y ENABLE_GATSBY_REFRESH_ENDPOINT=true gatsby develop", | ||
"develop:fast-refresh": "cross-env CYPRESS_SUPPORT=y ENABLE_GATSBY_REFRESH_ENDPOINT=true GATSBY_HOT_LOADER=fast-refresh gatsby develop", | ||
"serve": "gatsby serve", | ||
"start": "npm run develop", | ||
"format": "prettier --write \"src/**/*.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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
import React from "react" | ||
|
||
export default () => <h2 data-testid="sub-title">{`%SUB_TITLE%`}</h2> | ||
export default function SubTitle() { | ||
return ( | ||
<h2 data-testid="sub-title">{`%SUB_TITLE%`}</h2> | ||
) | ||
} |
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
import React from "react" | ||
|
||
export default () => <h1 data-testid="title">{`%TITLE%`}</h1> | ||
export default function Title() { | ||
return ( | ||
<h1 data-testid="title">{`%TITLE%`}</h1> | ||
) | ||
} |
4 changes: 3 additions & 1 deletion
4
e2e-tests/development-runtime/src/pages/client-dynamic-route/[id].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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import React from "react" | ||
import Layout from "../../components/layout" | ||
|
||
export default props => ( | ||
const ClientDynamicID = props => ( | ||
<Layout> | ||
<h1 data-testid="title">Client Dynamic Route</h1> | ||
<h2 data-testid="params">{props.params.id}</h2> | ||
</Layout> | ||
) | ||
|
||
export default ClientDynamicID |
4 changes: 3 additions & 1 deletion
4
e2e-tests/development-runtime/src/pages/client-dynamic-route/named-splat/[...name].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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import React from "react" | ||
import Layout from "../../../components/layout" | ||
|
||
export default props => ( | ||
const NamedSplat = props => ( | ||
<Layout> | ||
<h1 data-testid="title">Named SPLAT</h1> | ||
<h2 data-testid="splat">{props.params.name}</h2> | ||
</Layout> | ||
) | ||
|
||
export default NamedSplat |
4 changes: 3 additions & 1 deletion
4
e2e-tests/development-runtime/src/pages/client-dynamic-route/products/[brand]/[product].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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import React from "react" | ||
import Layout from "../../../../components/layout" | ||
|
||
export default props => ( | ||
const NestedClientOnlyRoute = props => ( | ||
<Layout> | ||
<h1 data-testid="title">Nested Dynamic Route</h1> | ||
<h2 data-testid="params-brand">{props.params.brand}</h2> | ||
<h2 data-testid="params-product">{props.params.product}</h2> | ||
</Layout> | ||
) | ||
|
||
export default NestedClientOnlyRoute |
4 changes: 3 additions & 1 deletion
4
e2e-tests/development-runtime/src/pages/client-dynamic-route/splat/[...].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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import React from "react" | ||
import Layout from "../../../components/layout" | ||
|
||
export default props => ( | ||
const SplatRoute = props => ( | ||
<Layout> | ||
<h1 data-testid="title">SPLAT!</h1> | ||
<h2 data-testid="splat">{props.params["*"]}</h2> | ||
</Layout> | ||
) | ||
|
||
export default SplatRoute |
4 changes: 3 additions & 1 deletion
4
e2e-tests/development-runtime/src/pages/collection-routing/{FakeData.title}/[...name].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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import React from "react" | ||
import Layout from "../../../components/layout" | ||
|
||
export default props => ( | ||
const FakeDataTitleName = props => ( | ||
<Layout> | ||
<h1 data-testid="title">Named SPLAT Nested with Collection Route!</h1> | ||
<h2 data-testid="splat">{props.params.name}</h2> | ||
</Layout> | ||
) | ||
|
||
export default FakeDataTitleName |
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
Oops, something went wrong.