Skip to content

feat(remote form): expose submitted property - #14811

Merged
Rich-Harris merged 12 commits into
sveltejs:mainfrom
hrueger:feat/expose-remote-form-submitted
Jun 25, 2026
Merged

feat(remote form): expose submitted property#14811
Rich-Harris merged 12 commits into
sveltejs:mainfrom
hrueger:feat/expose-remote-form-submitted

Conversation

@hrueger

@hrueger hrueger commented Oct 26, 2025

Copy link
Copy Markdown
Contributor

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

changeset-bot Bot commented Oct 26, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e02e3b6

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

Copilot AI left a comment

Copy link
Copy Markdown

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

hrueger commented Jan 5, 2026

Copy link
Copy Markdown
Contributor Author

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
Comment thread packages/kit/src/exports/public.d.ts Outdated
get result(): Output | undefined;
/** The number of pending submissions */
get pending(): number;
/** Whether the form has been tried to be submitted at least once */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
/** Whether the form has been tried to be submitted at least once */
/** True if the form has been submitted at least once */

@vercel vercel Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Additional Suggestion:

Server-side remote form is missing the submitted property, causing it to be undefined during SSR instead of false.

Fix on Vercel

@teemingc

teemingc commented May 19, 2026

Copy link
Copy Markdown
Member

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?

Here's what the Vercel Review bot suggested if you don't have access to see it:

the server runtime form code is missing the .submitted property causing it to be undefined during SSR

@hrueger

hrueger commented May 24, 2026

Copy link
Copy Markdown
Contributor Author

Hi @teemingc,
thanks for the review. I added the serverside property and updated the wording 👍

@Rich-Harris Rich-Harris left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thank you!

@Rich-Harris
Rich-Harris dismissed teemingc’s stale review June 25, 2026 17:05

changes were applied

@Rich-Harris
Rich-Harris merged commit 4f6bcbb into sveltejs:main Jun 25, 2026
25 of 26 checks passed
This was referenced Jun 25, 2026
Rich-Harris pushed a commit that referenced this pull request Jun 26, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to version-3, this PR
will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`version-3` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `version-3`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @sveltejs/adapter-netlify@7.0.0-next.1

### Major Changes


- breaking: require `vite@^8.0.12`, the first Vite 8 release bundling
stable `rolldown` 1.0.0
([#16134](#16134))


### Patch Changes

- Updated dependencies
[[`a9629f1`](a9629f1),
[`53d37f9`](53d37f9),
[`dba6239`](dba6239),
[`ab12cb6`](ab12cb6),
[`f0eab52`](f0eab52),
[`cd884c1`](cd884c1),
[`9ed38a8`](9ed38a8),
[`53aa049`](53aa049),
[`984e57a`](984e57a),
[`51785be`](51785be),
[`4f6bcbb`](4f6bcbb),
[`78e7137`](78e7137)]:
  - @sveltejs/kit@3.0.0-next.5
## @sveltejs/adapter-node@6.0.0-next.1

### Major Changes


- breaking: require `vite@^8.0.12`, the first Vite 8 release bundling
stable `rolldown` 1.0.0
([#16134](#16134))


### Patch Changes

- Updated dependencies
[[`a9629f1`](a9629f1),
[`53d37f9`](53d37f9),
[`dba6239`](dba6239),
[`ab12cb6`](ab12cb6),
[`f0eab52`](f0eab52),
[`cd884c1`](cd884c1),
[`9ed38a8`](9ed38a8),
[`53aa049`](53aa049),
[`984e57a`](984e57a),
[`51785be`](51785be),
[`4f6bcbb`](4f6bcbb),
[`78e7137`](78e7137)]:
  - @sveltejs/kit@3.0.0-next.5
## @sveltejs/adapter-vercel@7.0.0-next.1

### Major Changes


- breaking: require `vite@^8.0.12`, the first Vite 8 release bundling
stable `rolldown` 1.0.0
([#16134](#16134))


### Patch Changes

- Updated dependencies
[[`a9629f1`](a9629f1),
[`53d37f9`](53d37f9),
[`dba6239`](dba6239),
[`ab12cb6`](ab12cb6),
[`f0eab52`](f0eab52),
[`cd884c1`](cd884c1),
[`9ed38a8`](9ed38a8),
[`53aa049`](53aa049),
[`984e57a`](984e57a),
[`51785be`](51785be),
[`4f6bcbb`](4f6bcbb),
[`78e7137`](78e7137)]:
  - @sveltejs/kit@3.0.0-next.5
## @sveltejs/enhanced-img@1.0.0-next.1

### Major Changes


- breaking: require `vite@^8.0.12`, the first Vite 8 release bundling
stable `rolldown` 1.0.0
([#16134](#16134))
## @sveltejs/kit@3.0.0-next.5

### Major Changes


- breaking: remove `base`, `assets`, and `resolveRoute` from
`$app/paths` ([#15507](#15507))


- breaking: require Svelte config options to be passed through the Vite
plugin ([#16007](#16007))


- breaking: `goto` now rejects when called with a URL that does not
resolve to a route within the app, matching the existing behaviour for
external URLs ([#16164](#16164))


- breaking: add 'error' result type to `preloadData`
([#12579](#12579))


- breaking: require `vite@^8.0.12`, the first Vite 8 release bundling
stable `rolldown` 1.0.0
([#16134](#16134))


### Minor Changes


- feat: expose `submitted` property of remote forms
([#14811](#14811))


### Patch Changes


- fix: clear issues and touched states on form reset
([#16163](#16163))


- fix: return 404 for form actions and remote functions whose name is an
`Object.prototype` member
([#16072](#16072))


- feat: send periodic `keep-alive` SSE comments from `query.live` to
prevent idle-timeout errors
([#16063](#16063))


- fix: render pages over sibling endpoints without GET or HEAD handlers
([#16125](#16125))


- fix: sort directory entries when building the route manifest so node
indices are deterministic across runtimes (e.g. Bun and Node)
([#16074](#16074))


- fix: include hoisted packages in Vite's `server.fs.allow` list
([#15998](#15998))
## @sveltejs/package@3.0.0-next.1

### Patch Changes


- fix: declare typescript as an optional peer dependency so
svelte-package works under strict node-linkers
([#16073](#16073))

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Rich-Harris pushed a commit that referenced this pull request Jul 1, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @sveltejs/kit@2.69.0

### Minor Changes


- feat: expose `submitted` property of remote forms
([#14811](#14811))


### Patch Changes


- fix: clear issues and touched states on form reset
([#16163](#16163))


- fix: return `undefined` from `fields.branch.issues()` when only
`fields.branch.leaf` has issues
([#16187](#16187))

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

4 participants