next.js
d4e390d0 - test: de-flake rsc-cookies e2e tests (#71319)

Commit
1 year ago
test: de-flake rsc-cookies e2e tests (#71319) Since the `/rsc-cookies-delete` path has a side effect (it runs a middleware code path that deletes client cookies), prefetching this link leads to unpredictable behaviours and possible failures in tests that use this fixture, [such as this one](https://github.com/vercel/next.js/blob/047baaba7d53326f157adc3aaf4b3fb3e13813c2/test/e2e/app-dir/app-middleware/app-middleware.test.ts#L126). I fixed this with `prefetch={false}` but [per the docs](https://nextjs.org/docs/pages/api-reference/components/link#prefetch) it might be preferable to just use a plain `<a>` tag? I'm happy to make that change if you prefer. Alternatively, maybe a `GET` shouldn't have side effects; we could use a form here, fetch, or Server Action or something instead. Here's an example race when running the fixture manually (cookie 1 has been unset by the `/rsc-cookies-delete` prefetch): ![Screenshot 2024-10-15 at 14 13 13](https://github.com/user-attachments/assets/b8e21a74-f8fd-4e7c-ab2a-a4ce17212806) Co-authored-by: JJ Kasper <jj@jjsweb.site>
Author
Parents
Loading