File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -377,6 +377,30 @@ describe('Path comparisons', () => {
377377
378378 expect ( comparePaths ( obj1 , obj2 ) ) . toStrictEqual ( [ [ 'flavours' , '0' ] ] ) ;
379379 } ) ;
380+
381+ test ( 'Paths with different array values' , ( ) => {
382+ /*
383+ Array comparisons can unfortunately break the illusion that the form
384+ fields themselves are tainted.
385+ If you click on a checkbox to add an item, the array comparison will
386+ taint more than one field.
387+ */
388+
389+ const obj1 = {
390+ flavours : [ 'Mint choc chip' ] ,
391+ scoops : 1
392+ } ;
393+
394+ const obj2 = {
395+ flavours : [ 'Cookies and cream' , 'Mint choc chip' ] ,
396+ scoops : 1
397+ } ;
398+
399+ expect ( comparePaths ( obj1 , obj2 ) ) . toStrictEqual ( [
400+ [ 'flavours' , '0' ] ,
401+ [ 'flavours' , '1' ]
402+ ] ) ;
403+ } ) ;
380404} ) ;
381405
382406test ( 'Set paths' , ( ) => {
Original file line number Diff line number Diff line change @@ -1393,8 +1393,6 @@ function formEnhance<T extends AnyZodObject, M>(
13931393
13941394 htmlForm . submitting ( ) ;
13951395
1396- // TODO: If SPA, cancel request here, factor out the result callback and call it directly.
1397-
13981396 if ( options . SPA ) {
13991397 cancel ( ) ;
14001398
You can’t perform that action at this time.
0 commit comments