Skip to content

Commit

Permalink
fix: field array swap not working when falsy values are present at paths
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Jan 23, 2022
1 parent f736e62 commit 40afbd9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vee-validate/src/useFieldArray.ts
Expand Up @@ -107,7 +107,7 @@ export function useFieldArray<TValue = unknown>(arrayPath: MaybeRef<string>): Fi
function swap(indexA: number, indexB: number) {
const pathName = unref(arrayPath);
const pathValue = getFromPath<TValue[]>(form?.values, pathName);
if (!Array.isArray(pathValue) || !pathValue[indexA] || !pathValue[indexB]) {
if (!Array.isArray(pathValue) || !(indexA in pathValue) || !(indexB in pathValue)) {
return;
}

Expand Down

0 comments on commit 40afbd9

Please sign in to comment.