Skip to content

Add that enhanced forms can't be async to documentation #7606

@NormandoHall

Description

@NormandoHall

Describe the problem

I want to add extra data to the enhanced form before submit (captcha token in my case), I can't because can't be an async function.

<script>
  import x (async function)
<script>
<form
    action="?/login"
    method="POST"
    use:enhance={async ({ data }) => {
      await x;

      return async ({ result }) => {
        await invalidateAll();
        await applyAction(result);
      };
    }}
  >

    <input..../>
    <input..../>

    <button type="submit">Submit>/button>
  </form>

Based on: #7581

Describe the proposed solution

Make enhanced function async use:enhance={async ({ data }) => { or add as a note in form documentation.

Alternatives considered

No response

Importance

nice to have

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions