Skip to content

feat(remote form): expose submitted property#14811

Open
hrueger wants to merge 9 commits intosveltejs:mainfrom
hrueger:feat/expose-remote-form-submitted
Open

feat(remote form): expose submitted property#14811
hrueger wants to merge 9 commits intosveltejs:mainfrom
hrueger:feat/expose-remote-form-submitted

Conversation

@hrueger
Copy link
Copy Markdown

@hrueger hrueger commented Oct 26, 2025

Hi,
this exposes the submitted property of a remote form. This allows for displaying validity ui for form fields, as they should sometimes only appear after the form being submitted by the user.

I'm not sure if a test for this is needed. If so, please let me know and I'll look into that.


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Oct 26, 2025

🦋 Changeset detected

Latest commit: 1118567

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@svelte-docs-bot
Copy link
Copy Markdown

Copilot AI review requested due to automatic review settings January 5, 2026 11:23
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR exposes the submitted property of remote forms to enable developers to track whether a form has been submitted at least once. This is particularly useful for controlling when to display form field validity UI, which should typically only appear after the user has attempted to submit the form.

Key Changes

  • Made submitted reactive by converting it from a plain variable to $state(false)
  • Added a getter for submitted to the RemoteForm object
  • Updated TypeScript definitions in both public API and type definition files

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/kit/src/runtime/client/remote-functions/form.svelte.js Converted submitted to reactive state and exposed it via a getter property
packages/kit/src/exports/public.d.ts Added TypeScript definition for the submitted getter
packages/kit/types/index.d.ts Added TypeScript definition for the submitted getter
.changeset/spicy-plants-begin.md Added changeset documenting this as a minor feature addition

Comment thread packages/kit/src/runtime/client/remote-functions/form.svelte.js
@hrueger
Copy link
Copy Markdown
Author

hrueger commented Jan 5, 2026

I added the new feature to a test as Copilot recomended, but I'm unsure why it is undefined sometimes (see the NOTE). any ideas?

@teemingc teemingc added the forms Stuff relating to forms and form actions label Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

forms Stuff relating to forms and form actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants