Skip to content

Commit

Permalink
fix: empty array in form would trigger a file upload (#482)
Browse files Browse the repository at this point in the history
  • Loading branch information
alanpoulain committed Oct 6, 2022
1 parent ae2f272 commit bc86cc7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 3.4.1

* Fix empty array in form would trigger a file upload

## 3.4.0

* Add enum input guesser
Expand Down
2 changes: 1 addition & 1 deletion src/hydra/dataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function dataProvider(
const values = Object.values(hydraData);
const containFile = (element: unknown): boolean =>
Array.isArray(element)
? element.every((value) => containFile(value))
? element.length > 0 && element.every((value) => containFile(value))
: isPlainObject(element) &&
Object.values(element as Record<string, unknown>).some(
(value) => value instanceof File,
Expand Down

0 comments on commit bc86cc7

Please sign in to comment.