Files
Shu DingandGitHub a52ebf4089 Add tests for Suspensey CSS (#47708)
This PR adds a test to confirm that the component will be committed
after the stylesheet is loaded, by delaying the CSS request in
middleware and then check the active style in `useEffect` (technically
it should be `useLayoutEffect`). Since our current timeout for that is
set to 500ms, I also added a test with 1000ms delay to rule out false
negative cases.
2023-03-31 10:06:17 +02:00

23 lines
386 B
JavaScript

'use client'
import Link from 'next/link'
import { useEffect } from 'react'
import './style.css'
export default function Page() {
useEffect(() => {
console.log(
(window.__log =
'background = ' +
window.getComputedStyle(document.body).backgroundColor)
)
}, [])
return (
<div>
<Link href="/suspensey-css">Get back</Link>
</div>
)
}