MCPcopy
hub / github.com/vercel/next.js / waitForHydration

Function waitForHydration

test/lib/development-sandbox.ts:19–33  ·  view source on GitHub ↗
(browser: Playwright)

Source from the content-addressed store, hash-verified

17import { Playwright } from 'next-webdriver'
18
19export async function waitForHydration(browser: Playwright) {
20 await browser.eval(() => {
21 return new Promise<void>((resolve) => {
22 if ((window as any).__NEXT_HYDRATED) {
23 resolve()
24 } else {
25 var timeout = setTimeout(resolve, 30 * 1000)
26 ;(window as any).__NEXT_HYDRATED_CB = function () {
27 clearTimeout(timeout)
28 resolve()
29 }
30 }
31 })
32 })
33}
34
35export async function createSandbox(
36 next: NextInstance,

Callers 3

basic.test.tsFile · 0.90
patchFunction · 0.85

Calls 4

evalMethod · 0.80
resolveFunction · 0.50
setTimeoutFunction · 0.50
clearTimeoutFunction · 0.50

Tested by

no test coverage detected