Skip to content

feat(kit): clear dirty state when form values are restored - #17086

Open
dexhunter wants to merge 2 commits into
sveltejs:version-3from
dexhunter:feat/restore-form-dirty-state
Open

dexhunter wants to merge 2 commits into
sveltejs:version-3from
dexhunter:feat/restore-form-dirty-state

Conversation

@dexhunter

Copy link
Copy Markdown

Fixes #17072

form.fields.*.dirty() now clears when a value is restored to the form’s mounted baseline. This covers UI edits and programmatic nested updates while preserving touched state and the existing default-value behavior. Resetting or remounting the form establishes a fresh baseline.

With the same supported fixtures, pristine code passes 3 of the 15 selected browser cases and fails 12 dirty-state assertions; this change passes all 15. The original five requirement and guard cases improve from 2 passing to 5 passing.

Weco research trajectory includes the rejected attempts and their source snapshots. The final supported-fixture baseline and candidate are steps 4 and 5.

Local validation: formatting and lint passed; the full workspace type check passed with workspace concurrency set to 1; Kit unit tests recorded 779 passed, 0 failed and 110 pending; the 15 selected Playwright cases passed without retries, skips or flakes. Generated types and a minor feat: changeset are included. The full pnpm test suite was not run locally.


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.

Fixes sveltejs#17072

Co-Authored-By: Aiden <aiden@weco.ai>
@pkg-svelte-dev

pkg-svelte-dev Bot commented Sep 10, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 7fa6caa:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/7fa6caa607afda53dce4da2c2f3c22568b13e5d6

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/17086

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@changeset-bot

changeset-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7fa6caa

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

Comment thread packages/kit/types/index.d.ts.map Outdated
Fixes sveltejs#17072

Co-Authored-By: Aiden <aiden@weco.ai>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make dirty revert to false if original value is restored

1 participant