Skip to content

Commit

Permalink
Merge branch '2.2' into 2
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jun 25, 2024
2 parents 49d5750 + 09ebc84 commit bea2d5c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions client/src/components/Search/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ class Search extends Component {
const value = formData[key];
if (value) {
data[key] = value;
// For has_one relations an autoscaffoled SearchableDropdownField will be used that itself
// uses a react-select field which uses objects as values. We need to extract the value
if (key.substring(key.length - 2) === 'ID'
&& typeof value === 'object'
&& value.hasOwnProperty('value')
) {
data[key] = value.value;
}
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,7 @@ const SearchableDropdownField = ({
setHasChanges(true);
setJustChanged(true);
}
if (multi) {
onChange(val);
} else {
onChange(val, { value: val.value });
}
onChange(val);
};

/**
Expand Down Expand Up @@ -126,15 +122,6 @@ const SearchableDropdownField = ({

let val = value;

if (typeof val !== 'object' && (options && options.length > 0)) {
options.forEach(option => {
// eslint-disable-next-line eqeqeq
if (option.value == value) {
val = option;
}
});
}

// For non-multi only the first value is needed
if (!multi && val) {
const keys = Object.keys(val);
Expand Down

0 comments on commit bea2d5c

Please sign in to comment.