@@ -840,12 +840,12 @@ export function superForm<
840840 currentPath . pop ( ) ;
841841 }
842842
843+ const joinedPath = currentPath . join ( '.' ) ;
844+
843845 function addError ( ) {
844846 //console.log('Adding error', `[${error.path.join('.')}]`, error.value); //debug
845847 setPaths ( output , [ error . path ] , error . value ) ;
846848
847- const joinedPath = currentPath . join ( '.' ) ;
848-
849849 if ( options . customValidity && isEventError && validity . has ( joinedPath ) ) {
850850 const { el, message } = validity . get ( joinedPath ) ! ;
851851
@@ -859,10 +859,16 @@ export function superForm<
859859
860860 if ( force ) return addError ( ) ;
861861
862+ const lastPath = error . path [ error . path . length - 1 ] ;
863+ const isObjectError = lastPath == '_errors' ;
864+
862865 const isEventError =
863866 error . value &&
864867 paths . some ( ( path ) => {
865- return currentPath && path && currentPath . length > 0 && currentPath [ 0 ] == path [ 0 ] ;
868+ // If array/object, any part of the path can match. If not, exact match is required
869+ return isObjectError
870+ ? currentPath && path && currentPath . length > 0 && currentPath [ 0 ] == path [ 0 ]
871+ : joinedPath == path . join ( '.' ) ;
866872 } ) ;
867873
868874 if ( isEventError && options . validationMethod == 'oninput' ) return addError ( ) ;
@@ -890,10 +896,6 @@ export function superForm<
890896 return addError ( ) ;
891897 }
892898
893- const lastPath = error . path [ error . path . length - 1 ] ;
894- const isObjectError = lastPath == '_errors' ;
895- //const isErrorInArray = error.path.some((p) => /^\d+$/.test(String(p)));
896-
897899 if ( isObjectError ) {
898900 // New object errors should be displayed on blur events,
899901 // or the (parent) path is or has been tainted.
0 commit comments