File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
packages/kit/src/runtime/client/remote-functions Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @sveltejs/kit ' : patch
3+ ---
4+
5+ fix: wait a tick before collecting form data for validation
Original file line number Diff line number Diff line change @@ -512,13 +512,20 @@ export function form(id) {
512512
513513 const id = ++ validate_id ;
514514
515+ // wait a tick in case the user is calling validate() right after set() which takes time to propagate
516+ await tick ( ) ;
517+
515518 const form_data = new FormData ( element , submitter ) ;
516519
517520 /** @type {readonly StandardSchemaV1.Issue[] } */
518521 let array = [ ] ;
519522
520523 const validated = await preflight_schema ?. [ '~standard' ] . validate ( convert ( form_data ) ) ;
521524
525+ if ( validate_id !== id ) {
526+ return ;
527+ }
528+
522529 if ( validated ?. issues ) {
523530 array = validated . issues ;
524531 } else {
You can’t perform that action at this time.
0 commit comments