Skip to content

Commit

Permalink
Merge branch 'canary' into hrmny/fix-group-layout-404
Browse files Browse the repository at this point in the history
  • Loading branch information
ForsakenHarmony authored Oct 26, 2023
2 parents c91cd77 + c80fb27 commit b98b017
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 31 deletions.
28 changes: 2 additions & 26 deletions packages/next/src/server/lib/router-utils/setup-dev-bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,31 +366,17 @@ async function startWatcher(opts: SetupOpts) {
const serverPathState = new Map<string, string>()

async function processResult(
id: string,
result: TurbopackResult<WrittenEndpoint>
): Promise<TurbopackResult<WrittenEndpoint>> {
// Figure out if the server files have changed
let hasChange = false
for (const { path: p, contentHash } of result.serverPaths) {
// We ignore source maps
if (p.endsWith('.map')) continue
let key = `${id}:${p}`
const localHash = serverPathState.get(key)
const globaHash = serverPathState.get(p)
if (
(localHash && localHash !== contentHash) ||
(globaHash && globaHash !== contentHash)
) {
const previousHash = serverPathState.get(p)
if (previousHash !== contentHash) {
hasChange = true
serverPathState.set(key, contentHash)
serverPathState.set(p, contentHash)
} else {
if (!localHash) {
serverPathState.set(key, contentHash)
}
if (!globaHash) {
serverPathState.set(p, contentHash)
}
}
}

Expand Down Expand Up @@ -1087,7 +1073,6 @@ async function startWatcher(opts: SetupOpts) {
if (middleware) {
const processMiddleware = async () => {
const writtenEndpoint = await processResult(
'middleware',
await middleware.endpoint.writeToDisk()
)
processIssues('middleware', 'middleware', writtenEndpoint)
Expand Down Expand Up @@ -1313,7 +1298,6 @@ async function startWatcher(opts: SetupOpts) {
try {
if (globalEntries.app) {
const writtenEndpoint = await processResult(
'_app',
await globalEntries.app.writeToDisk()
)
processIssues('_app', '_app', writtenEndpoint)
Expand All @@ -1323,7 +1307,6 @@ async function startWatcher(opts: SetupOpts) {

if (globalEntries.document) {
const writtenEndpoint = await processResult(
'_document',
await globalEntries.document.writeToDisk()
)
changeSubscription(
Expand All @@ -1341,7 +1324,6 @@ async function startWatcher(opts: SetupOpts) {

if (globalEntries.error) {
const writtenEndpoint = await processResult(
'_error',
await globalEntries.error.writeToDisk()
)
processIssues(page, page, writtenEndpoint)
Expand Down Expand Up @@ -1411,7 +1393,6 @@ async function startWatcher(opts: SetupOpts) {
try {
if (globalEntries.app) {
const writtenEndpoint = await processResult(
'_app',
await globalEntries.app.writeToDisk()
)
processIssues('_app', '_app', writtenEndpoint)
Expand All @@ -1421,7 +1402,6 @@ async function startWatcher(opts: SetupOpts) {

if (globalEntries.document) {
const writtenEndpoint = await processResult(
'_document',
await globalEntries.document.writeToDisk()
)

Expand All @@ -1439,7 +1419,6 @@ async function startWatcher(opts: SetupOpts) {
await loadPagesManifest('_document')

const writtenEndpoint = await processResult(
page,
await route.htmlEndpoint.writeToDisk()
)

Expand Down Expand Up @@ -1497,7 +1476,6 @@ async function startWatcher(opts: SetupOpts) {

finishBuilding = startBuilding(buildingKey)
const writtenEndpoint = await processResult(
page,
await route.endpoint.writeToDisk()
)

Expand All @@ -1522,7 +1500,6 @@ async function startWatcher(opts: SetupOpts) {
case 'app-page': {
finishBuilding = startBuilding(buildingKey)
const writtenEndpoint = await processResult(
page,
await route.htmlEndpoint.writeToDisk()
)

Expand Down Expand Up @@ -1573,7 +1550,6 @@ async function startWatcher(opts: SetupOpts) {
case 'app-route': {
finishBuilding = startBuilding(buildingKey)
const writtenEndpoint = await processResult(
page,
await route.endpoint.writeToDisk()
)

Expand Down
8 changes: 3 additions & 5 deletions test/turbopack-tests-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3197,11 +3197,9 @@
"app dir - hooks from pages should have the correct hooks",
"app dir - hooks useDraftMode should genenerate rand when draft mode enabled",
"app dir - hooks useDraftMode should use initial rand when draft mode be disabled",
"app dir - hooks useRouter should allow access to the router"
],
"failed": [
"app dir - hooks usePathname should have the canonical url pathname on rewrite",
"app dir - hooks usePathname should have the correct pathname",
"app dir - hooks useRouter should allow access to the router",
"app dir - hooks useSearchParams should have the canonical url search params on rewrite",
"app dir - hooks useSearchParams should have the correct search params",
"app dir - hooks useSelectedLayoutSegment should have the correct layout segment at /hooks/use-selected-layout-segment/first",
Expand All @@ -3216,6 +3214,7 @@
"app dir - hooks useSelectedLayoutSegments should have the correct layout segments at /hooks/use-selected-layout-segment/rewritten-middleware",
"app dir - hooks useSelectedLayoutSegments should return an empty array in pages"
],
"failed": [],
"pending": [],
"flakey": [],
"runtimeError": false
Expand Down Expand Up @@ -13519,7 +13518,6 @@
"test/integration/react-streaming/test/index.test.js": {
"passed": [
"streaming dev dev should not stream to crawlers or google pagerender bot",
"streaming dev dev should render 500 error correctly",
"streaming dev dev should render fallback if error raised from suspense during streaming",
"streaming dev dev should support streaming for fizz response"
],
Expand All @@ -13530,7 +13528,7 @@
"production mode streaming prod prod should render fallback if error raised from suspense during streaming",
"production mode streaming prod prod should support streaming for fizz response"
],
"flakey": [],
"flakey": ["streaming dev dev should render 500 error correctly"],
"runtimeError": false
},
"test/integration/read-only-source-hmr/test/index.test.js": {
Expand Down

0 comments on commit b98b017

Please sign in to comment.