-
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(hmr): accept hot updates for modules above page templates (#29752)
* fix(hmr): accept hot updates for modules above page templates * actually use fast-refresh for gatsby-browser and shadowed theme-ui config * exclude actually need to be instance of RegExp * tmp * more tmp * init navigation after loader is set * cleanup tmp code * init navigation after resources for current page are loaded * remove commented out code * revert devtool change
- Loading branch information
Showing
7 changed files
with
74 additions
and
29 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
e2e-tests/development-runtime/cypress/integration/hot-reloading/gatsby-browser.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,24 @@ | ||
const TEST_ID = `gatsby-browser-hmr` | ||
|
||
describe(`hot reloading above page template (gatsby-browser)`, () => { | ||
beforeEach(() => { | ||
cy.visit(`/`).waitForRouteChange() | ||
}) | ||
it(`displays placeholder content on launch`, () => { | ||
cy.getTestElement(TEST_ID).should( | ||
`contain.text`, | ||
`%TEST_HMR_IN_GATSBY_BROWSER%` | ||
) | ||
}) | ||
|
||
it(`hot reloads with new content`, () => { | ||
const text = `HMR_IN_GATSBY_BROWSER_WORKS` | ||
cy.exec( | ||
`npm run update -- --file src/wrap-root-element.js --replacements "TEST_HMR_IN_GATSBY_BROWSER:${text}"` | ||
) | ||
|
||
cy.waitForHmr() | ||
|
||
cy.getTestElement(TEST_ID).should(`contain.text`, text) | ||
}) | ||
}) |
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