Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* Cookie reading and subscription for the instant navigation devtools panel.
*
* The cookie value is a JSON array:
* [0] — pending (waiting to capture)
* [1, null] — captured MPA page load
* [1, { from, to }] — captured SPA navigation (from/to route trees)
* [0, id] — pending (waiting to capture)
* [1, id, null] — captured MPA page load
* [1, id, { from, to }] — captured SPA navigation (from/to route trees)
*
* The "to" tree may be null initially and updated after the prefetch resolves.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function InstantNavsPanel() {
if (typeof cookieStore !== 'undefined') {
cookieStore.set({
name: COOKIE_NAME,
value: JSON.stringify([0, `p${Math.random()}`]),
value: JSON.stringify([0, `p${Math.random()}`, null]),
path: '/',
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ describe('instant-nav-panel', () => {
await browser.elementByCss('[data-instant-nav]').click()
}

async function clickViewPageLoad(browser: Playwright) {
await browser
// TODO: Monitor if we need to increase timeouts for all *instant calls
.elementByCss('[data-instant-nav-refresh]', { timeout: 50 })
.click()
await waitForInstantModeCookie(browser)
}

async function clickStartClientNav(browser: Playwright) {
await browser
// TODO: Monitor if we need to increase timeouts for all *instant calls
Expand Down Expand Up @@ -94,6 +102,22 @@ describe('instant-nav-panel', () => {
await clearInstantModeCookie(browser)
})

it('should show page load state after clicking Reload', async () => {
const browser = await next.browser('/target-page/my-post?search=foo')
await clearInstantModeCookie(browser)

await openInstantNavPanel(browser)

await clickViewPageLoad(browser)

await retry(async () => {
const text = await getInstantNavPanelText(browser)
expect(text).toContain('Page load')
expect(text).toContain('pre-rendered static UI')
expect(text).toContain('Continue rendering')
})
})

it('should show client nav state after clicking Start and navigating', async () => {
const targetPage = '/target-page/my-post?search=foo'
const [browser] = await Promise.all([
Expand Down
Loading