Skip to content

use:enhance breaks HMR and routing in dev with <input name="method" /> #8467

Description

Describe the bug

Creating a form with and input with the name of "method" breaks both hot module reloading and routing in development mode. The pages build and run just fine on preview, but you get this message in the developer's console and navigating to and from this page freezes navigation (again only in development mode). It seems to stem from these lines, where it checks form.method

Image of Issue

Reproduction

https://github.com/awenzel5/sveltekit-enhance-method

Logs

forms.js?v=80aa9393:30 Uncaught (in promise) Error: use:enhance can only be used on <form> fields with method="POST"
    at enhance (forms.js?v=80aa9393:30:9)
    at mount (+page.svelte? [sm]:8:41)
    at targetCmp.$$.fragment.m (svelte-hooks.js?v=80aa9393:291:24)
    at mount_component (index.mjs:1949:26)
    at Object.update [as p] (root.svelte? [sm]:41:39)
    at update_slot_base (index.mjs:100:14)
    at Object.update [as p] (layout.svelte?v=80aa9393:40:6)
    at update (index.mjs:1209:36)
    at flush (index.mjs:1169:17)

System Info

System:
    OS: Linux 5.10 Ubuntu 20.04.5 LTS (Focal Fossa)
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i9-12900H
    Memory: 21.68 GB / 24.79 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
    npm: 9.2.0 - ~/.nvm/versions/node/v18.12.1/bin/npm
  npmPackages:
    @sveltejs/adapter-auto: ^1.0.0 => 1.0.0 
    @sveltejs/kit: ^1.0.0 => 1.0.11 
    svelte: ^3.54.0 => 3.55.1 
    vite: ^4.0.0 => 4.0.4

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions