mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
baf4401c7b
At first, we performed one naive traversal per page to collect all client references. That had the problem that references used by multiple layout segments were attributed only to the first layout segment (e.g. only on `not-found` and not on `page`). Because the traversal doesn't revisit nodes. That particular problem was fixed by https://github.com/vercel/next.js/pull/81704. But it didn't consider the fact that the order of client references isn't correctly modelled by having a `client reference -> vec<server components>` mapping to fixup whatever the graph traversal missed. In this particular case, layout segment B had a unique client reference and one shared with layout segment A. So the fixup from above would then make B have `unique reference, shared reference` (because they were just added at the end), even though the real order (according to the graph is the reverse). Instead, traverse once per layout segment, which doesn't have this problem.
28 lines
725 B
TypeScript
28 lines
725 B
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
|
|
describe('initial-css-order', () => {
|
|
const { next } = nextTestSetup({
|
|
files: __dirname,
|
|
})
|
|
|
|
it('should serve styles in the correct order for the page', async () => {
|
|
const browser = await next.browser('/')
|
|
|
|
expect(
|
|
await browser.eval(
|
|
`window.getComputedStyle(document.querySelector('body')).backgroundColor`
|
|
)
|
|
).toBe('rgb(0, 128, 0)')
|
|
})
|
|
|
|
it('should serve styles in the correct order for global-not-found', async () => {
|
|
const browser = await next.browser('/404')
|
|
|
|
expect(
|
|
await browser.eval(
|
|
`window.getComputedStyle(document.querySelector('body')).backgroundColor`
|
|
)
|
|
).toBe('rgb(255, 0, 0)')
|
|
})
|
|
})
|