Skip to content

Commit

Permalink
Fix page hot loading fixes #3255 (#3256)
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAMathews committed Dec 17, 2017
1 parent 2eaa523 commit fed1c97
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/gatsby/src/internal-plugins/query-runner/pages-writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,18 @@ const debouncedWritePages = _.debounce(
500,
{ leading: true }
)
emitter.on(`CREATE_PAGE`, () => {
// Ignore CREATE_PAGE until bootstrap is finished
// as this is called many many times during bootstrap and
// we can ignore them until CREATE_PAGE_END is called.
//
// After bootstrap, we need to listen for this as stateful page
// creators e.g. the internal plugin "component-page-creator"
// calls createPage directly so CREATE_PAGE_END won't get fired.
if (bootstrapFinished) {
debouncedWritePages()
}
})

emitter.on(`CREATE_PAGE_END`, () => {
debouncedWritePages()
Expand Down

0 comments on commit fed1c97

Please sign in to comment.