Skip to content

Commit

Permalink
Merge pull request #20 from lolocompany/jesper/test-id-if-empty-list
Browse files Browse the repository at this point in the history
fix: in ref input widget, find by id if no res
  • Loading branch information
MrLarssonJr authored Jul 5, 2024
2 parents 578ddc5 + 6b6e7f2 commit e54d817
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/rjsf/ReferenceInputWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function ReferenceInputWidget(props) {
setLoading(false);

// Ugly hack for resources without a name field (createById)
if (res.data.length && res.data.every(item => !item.name)) {
if (!res.data.length || (res.data.length && res.data.every(item => !item.name))) {
setFindBy('id');
}

Expand Down

0 comments on commit e54d817

Please sign in to comment.