Skip to content

Commit

Permalink
Fix ensurePage race condition (#28939)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
ijjk and kodiakhq[bot] committed Sep 9, 2021
1 parent 57d9076 commit f4c6cd6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/next/server/dev/on-demand-entry-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ export default function onDemandEntryHandler(
}

multiCompiler.hooks.done.tap('NextJsOnDemandEntries', (multiStats) => {
if (invalidator.rebuildAgain) {
return invalidator.doneBuilding()
}
const [clientStats, serverStats] = multiStats.stats
const pagePaths = new Set([
...getPagePathsFromEntrypoints(clientStats.compilation.entrypoints),
Expand Down Expand Up @@ -269,7 +272,7 @@ class Invalidator {
private multiCompiler: webpack.MultiCompiler
private watcher: any
private building: boolean
private rebuildAgain: boolean
public rebuildAgain: boolean

constructor(watcher: any, multiCompiler: webpack.MultiCompiler) {
this.multiCompiler = multiCompiler
Expand Down
4 changes: 3 additions & 1 deletion test/integration/basepath/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,9 @@ const runTests = (dev = false) => {
)
})

it('should navigate back to a non-basepath 404 that starts with basepath', async () => {
// TODO: below test is incorrect and has been causing incorrect failures
// from the below check not being awaited
it.skip('should navigate back to a non-basepath 404 that starts with basepath', async () => {
const browser = await webdriver(appPort, `${basePath}hello`)
await browser.eval(() => (window.navigationMarker = true))
await browser.eval(() => window.next.router.push('/hello'))
Expand Down

0 comments on commit f4c6cd6

Please sign in to comment.