Skip to content

Commit

Permalink
fix(form-core): ignore undefined field values for equality
Browse files Browse the repository at this point in the history
  • Loading branch information
gutentag2012 committed May 24, 2024
1 parent 7e56e70 commit 1fe72c0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/form-core/src/utils/equality.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,16 @@ function getLeftUnequalPathsInternal(
for (const key of aKeys) {
const nextKey = currentKey ? `${currentKey}.${key}` : key

const valA = aNonNullable[key as keyof typeof aNonNullable]
// Undefined values are basically invisible
if (valA === undefined) {
continue
}

if (!(key in bNonNullable)) {
internalAcc = [...internalAcc, nextKey]
continue
}
const valA = aNonNullable[key as keyof typeof aNonNullable]
const valB = bNonNullable[key as keyof typeof bNonNullable]

internalAcc = getLeftUnequalPathsInternal(valA, valB, nextKey, internalAcc)
Expand Down

0 comments on commit 1fe72c0

Please # to comment.