Skip to content

Commit b4bca1a

Browse files
committed
[form] Optimize field errors update
1 parent f83461b commit b4bca1a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/form/src/form/internals.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export class FormErrors {
131131
const set = new Set(errors);
132132
this.#map.set(path, {
133133
set,
134-
array: Array.from(set),
134+
array: errors.length > set.size ? Array.from(set) : errors,
135135
});
136136
} else {
137137
this.#map.delete(path);
@@ -144,7 +144,7 @@ export class FormErrors {
144144
}
145145

146146
clear() {
147-
this.#map.clear()
147+
this.#map.clear();
148148
}
149149

150150
*[Symbol.iterator]() {

0 commit comments

Comments
 (0)