+ {#each set.fields.allIssues() as issue}
+
{issue.message}
+ {/each}
+
diff --git a/packages/kit/test/apps/basics/src/routes/remote/form/preflight-only/form.remote.ts b/packages/kit/test/apps/basics/src/routes/remote/form/preflight-only/form.remote.ts
new file mode 100644
index 000000000000..a8fc4a2d88f3
--- /dev/null
+++ b/packages/kit/test/apps/basics/src/routes/remote/form/preflight-only/form.remote.ts
@@ -0,0 +1,19 @@
+import { form, query } from '$app/server';
+import * as v from 'valibot';
+
+let data = { a: '', b: '', c: '' };
+
+export const get = query(() => {
+ return data;
+});
+
+export const set = form(
+ v.object({
+ a: v.pipe(v.string(), v.minLength(3, 'a is too short')),
+ b: v.pipe(v.string(), v.minLength(3, 'b is too short')),
+ c: v.pipe(v.string(), v.minLength(3, 'c is too short'))
+ }),
+ async (d) => {
+ data = d;
+ }
+);
diff --git a/packages/kit/test/apps/basics/test/test.js b/packages/kit/test/apps/basics/test/test.js
index 1e64ded04982..9b57a59b79d7 100644
--- a/packages/kit/test/apps/basics/test/test.js
+++ b/packages/kit/test/apps/basics/test/test.js
@@ -1841,6 +1841,31 @@ test.describe('remote functions', () => {
}
});
+ test('form preflight-only validation works', async ({ page, javaScriptEnabled }) => {
+ if (!javaScriptEnabled) return;
+
+ await page.goto('/remote/form/preflight-only');
+
+ const a = page.locator('[name="a"]');
+ const button = page.locator('button');
+ const issues = page.locator('.issues');
+
+ await button.click();
+ await expect(issues).toContainText('a is too short');
+ await expect(issues).toContainText('b is too short');
+ await expect(issues).toContainText('c is too short');
+
+ await a.fill('aaaaaaaa');
+ await expect(issues).toContainText('a is too long');
+
+ // server issues should be preserved...
+ await expect(issues).toContainText('b is too short');
+ await expect(issues).toContainText('c is too short');
+
+ // ...unless overridden by client issues
+ await expect(issues).not.toContainText('a is too short');
+ });
+
test('form validate works', async ({ page, javaScriptEnabled }) => {
if (!javaScriptEnabled) return;
diff --git a/packages/kit/types/index.d.ts b/packages/kit/types/index.d.ts
index d131766a3d12..cc02ddb3e4c1 100644
--- a/packages/kit/types/index.d.ts
+++ b/packages/kit/types/index.d.ts
@@ -1997,7 +1997,10 @@ declare module '@sveltejs/kit' {
preflight(schema: StandardSchemaV1