cloudflare/vinext

`next/form` (`<Form>`) soft navigation not implemented

已关闭

#1,355 创建于 2026年5月20日

 (1 条评论) (0 个反应) (0 位负责人)TypeScript (371 个派生)github user discovery
adapter-api-e2ehelp wanted

仓库指标

星标
 (8,563 个星标)
PR 合并指标
 (平均合并 1天 1小时) (30 天内合并 462 个 PR)

描述

This issue was created by an agent analysing CI failures from the Next.js Deploy Suite (vinext main vs Next.js v16.2.6, 2026-05-20).

Problem

The next/form <Form> component does not perform client-side soft navigation. Form submissions fall through to the browser's default behavior (full MPA page navigation) instead of being intercepted for SPA-style transitions.

Tests verify that after a form submission, the page did NOT do a full MPA navigation (didMpaNavigate() should return false). In vinext, it returns true because the form submit causes a full page reload.

Additionally, client action functions passed to action/formAction props do not execute.

Estimated Impact

~14 test failures.

Affected Test Suites

  • test/e2e/next-form/default/pages-dir.test.ts (9 failures)
  • test/e2e/next-form/default/app-dir.test.ts (5 failures)
  • test/e2e/next-form/basepath/next-form-basepath.test.ts (1 failure)

Recommendation

  1. Reproduce first in vinext's own test suite. Add a test with a <Form> component from next/form and verify that submission performs soft navigation. Confirm it currently does a full page reload.

  2. Study the Next.js <Form> implementation. Search .nextjs-ref/packages/next/src/client/form.tsx to understand how form submissions are intercepted and converted to client-side navigations using the router.

  3. Implement <Form> in the next/form shim. The component needs to: (a) intercept the submit event, (b) serialize form data, (c) use router.push() or router.replace() for the navigation, (d) support client action functions via action/formAction props.

  4. Handle both App Router and Pages Router. The Form component should work in both contexts.

贡献者指南