Skip to content

Commit

Permalink
fix failing test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
shuding committed Apr 26, 2023
1 parent e841aca commit 0dcb130
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions packages/next/src/server/node-web-streams-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ function createHeadInsertionTransformStream(
})
}
},
async flush(controller) {
// Check before closing if there's anything remaining to insert.
const insertion = await insert()
if (insertion) {
controller.enqueue(encodeText(insertion))
}
},
})
}

Expand Down
4 changes: 2 additions & 2 deletions test/e2e/app-dir/app-css/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,10 @@ createNextDescribe(
const initialHtml = await next.render('/css/css-duplicate-2/server')

// Even if it's deduped by Float, it should still only be included once in the payload.
// There are two matches, one for the rendered <link> and one for the flight data.
// There are 3 matches, one for the rendered <link>, one for float preload and one for the <link> inside flight payload.
expect(
initialHtml.match(/css-duplicate-2\/layout\.css/g).length
).toBe(2)
).toBe(3)
})

it('should only load chunks for the css module that is used by the specific entrypoint', async () => {
Expand Down

0 comments on commit 0dcb130

Please sign in to comment.