sveltejs / sveltejs/kit

Document `form().pending` in the remote functions

Open
#14,655 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

Until now, form submission pending state required customizing the use:enhance as documented in this tutorial.

I've personally created a svelte-form-enhanced library just to handle this issue.

This can now be achieved with form().pending, but is only mentioned in the multiple instances of a form section.

{#each await getTodos() as todo}
  {@const modify = modifyTodo.for(todo.id)}
  <form {...modify}>
    <!-- -->
    <button disabled={!!modify.pending}>save changes</button>
  </form>
{/each}
Describe the proposed solution

I hope it is documented as an independent section.

  • Disable form when there is a pending submission (avoid double click, double submission in the client)
  • Show saving state as in the existing tutorial.
<script lang="ts">
  import { addId } from './ids.remote';
</script>

<form {...addId}>
  <fieldset disabled={!!addId.pending}>
    <!-- form content goes here -->
  </fieldset>
</form>
Alternatives considered

No response

Importance

nice to have

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the remote functions documentation at the existing “Multiple instances of a form” section and compare its form().pending example with the linked customizing use:enhance tutorial. Add an independent explanation covering pending submissions, disabled controls, and saving feedback; done means the remote functions docs clearly show these use cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.