Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[next@15] Prefetch priority not respected(?) #2678

Open
serhalp opened this issue Oct 17, 2024 · 0 comments
Open

[next@15] Prefetch priority not respected(?) #2678

serhalp opened this issue Oct 17, 2024 · 0 comments
Labels
Next.js e2e test failure Errors identified through the Next.js repo e2e tests Next.js

Comments

@serhalp
Copy link
Contributor

serhalp commented Oct 17, 2024

This seems to have started in https://github.com/vercel/next.js/releases/tag/v15.0.0-canary.154 or https://github.com/vercel/next.js/releases/tag/v15.0.0-canary.155. But this could be a red herring — we landed multiple other fixes to the e2e tests right around this time, which may have been obscuring this latent issue.

  ● app dir - prefetching › fetch priority › should prefetch links in viewport with low priority
    expect(received).toBe(expected) // Object.is equality
    Expected: true
    Received: false
      402 |       await retry(async () => {
      403 |         expect(requests.length).toBeGreaterThan(0)
    > 404 |         expect(requests.every((req) => req.priority === 'low')).toBe(true)
          |                                                                 ^
      405 |       })
      406 |     })
      407 |
      at toBe (e2e/app-dir/app-prefetch/prefetching.test.ts:404:65)
      at fn (lib/next-test-utils.ts:806:20)
      at Object.<anonymous> (e2e/app-dir/app-prefetch/prefetching.test.ts:402:7)
  ● app dir - prefetching › fetch priority › should prefetch with high priority when navigating to a page without a prefetch entry
    expect(received).toBe(expected) // Object.is equality
    Expected: "high"
    Received: undefined
      430 |       await retry(async () => {
      431 |         expect(requests.length).toBe(1)
    > 432 |         expect(requests[0].priority).toBe('high')
          |                                      ^
      433 |       })
      434 |     })
      435 |
      at toBe (e2e/app-dir/app-prefetch/prefetching.test.ts:432:38)
      at fn (lib/next-test-utils.ts:806:20)
      at Object.<anonymous> (e2e/app-dir/app-prefetch/prefetching.test.ts:430:7)
  ● app dir - prefetching › fetch priority › should have an auto priority for all other fetch operations
    expect(received).toBe(expected) // Object.is equality
    Expected: "low"
    Received: undefined
      459 |         )
      460 |         expect(dashboardRequests.length).toBe(2)
    > 461 |         expect(dashboardRequests[0].priority).toBe('low') // the first request is the prefetch
          |                                               ^
      462 |         expect(dashboardRequests[1].priority).toBe('auto') // the second request is the lazy fetch to fill in missing data
      463 |       })
      464 |     })
      at toBe (e2e/app-dir/app-prefetch/prefetching.test.ts:461:47)
      at fn (lib/next-test-utils.ts:806:20)
      at Object.<anonymous> (e2e/app-dir/app-prefetch/prefetching.test.ts:456:7)
Test Suites: 1 failed, 1 total
Tests:       3 failed, 14 passed, 17 total

File: test/e2e/app-dir/app-prefetch/prefetching.test.ts

The logic is here: https://github.com/vercel/next.js/blob/4837a67fb9bc7199e48cd8bd2cc42659b17dfacc/packages/next/src/client/components/router-reducer/fetch-server-response.ts#L153-L165.

Our hypothesis is that it's just a test setup issue related to __NEXT_TEST_MODE. Reading through the code it seems like it's next.js that should be passing it to the spawned next process, but who knows.

Data

The following is parsed automatically by the Next.js repo e2e test report generator.

test: test/e2e/app-dir/app-prefetch/prefetching.test.ts
reason: Prefetch priority is not threaded through to fetch calls

@serhalp serhalp added the Next.js e2e test failure Errors identified through the Next.js repo e2e tests label Oct 17, 2024
@serhalp serhalp added the Next.js label Oct 17, 2024 — with Linear
@serhalp serhalp changed the title Prefetch priority not respected(?) [next@15] Prefetch priority not respected(?) Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Next.js e2e test failure Errors identified through the Next.js repo e2e tests Next.js
Projects
None yet
Development

No branches or pull requests

1 participant