File tree Expand file tree Collapse file tree 2 files changed +27
-25
lines changed Expand file tree Collapse file tree 2 files changed +27
-25
lines changed Original file line number Diff line number Diff line change @@ -744,20 +744,22 @@ export function superForm<
744744
745745 options,
746746
747- capture : ( ) => ( {
748- valid : get ( Valid ) ,
749- errors : get ( Errors ) ,
750- data : get ( Form ) ,
751- empty : get ( Empty ) ,
752- constraints : get ( Constraints ) ,
753- message : get ( Message ) ,
754- id : formId ,
755- meta : get ( Meta ) ,
756- tainted : get ( Tainted )
757- } ) ,
758-
759- restore : ( snapshot : SuperFormSnapshot < T2 , M > ) => {
760- rebind ( snapshot , snapshot . tainted ?? true ) ;
747+ capture : function ( ) {
748+ return {
749+ valid : get ( Valid ) ,
750+ errors : get ( Errors ) ,
751+ data : get ( Form ) ,
752+ empty : get ( Empty ) ,
753+ constraints : get ( Constraints ) ,
754+ message : get ( Message ) ,
755+ id : formId ,
756+ meta : get ( Meta ) ,
757+ tainted : get ( Tainted )
758+ } ;
759+ } ,
760+
761+ restore : function ( snapshot : SuperFormSnapshot < T2 , M > ) {
762+ return rebind ( snapshot , snapshot . tainted ?? true ) ;
761763 } ,
762764
763765 validate : ( path , opts ) => {
Original file line number Diff line number Diff line change 66
77 export let data: PageData ;
88
9+ export const snapshot: Snapshot = {
10+ capture : () => {
11+ console .log (' Capture' , $page );
12+ return capture ();
13+ },
14+ restore : (value ) => {
15+ console .log (' Restore' , value , $page );
16+ restore (value );
17+ }
18+ };
19+
920 const {
1021 form,
1122 errors,
2233 console .log ($page .status );
2334 }
2435 });
25-
26- export const snapshot: Snapshot = {
27- capture : () => {
28- console .log (' Capture' , $page );
29- return capture ();
30- },
31- restore : (value ) => {
32- console .log (' Restore' , value , $page );
33- restore (value );
34- }
35- };
3636 </script >
3737
3838<SuperDebug data ={{ $form , capture : capture () }} />
You can’t perform that action at this time.
0 commit comments