Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: silverstripe/silverstripe-admin
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.2.9
Choose a base ref
...
head repository: silverstripe/silverstripe-admin
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2.2.10
Choose a head ref
  • 2 commits
  • 3 files changed
  • 2 contributors

Commits on Jun 19, 2024

  1. FIX Use correct argument for FormBuilder context

    emteknetnz committed Jun 19, 2024
    Copy the full SHA
    a11d448 View commit details

Commits on Jun 21, 2024

  1. Merge pull request #1786 from creative-commoners/pulls/2.2/elemental-…

    …dropdown
    
    FIX Use correct argument for FormBuilder context
    GuySartorelli authored Jun 21, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    09ebc84 View commit details
Showing with 10 additions and 15 deletions.
  1. +1 −1 client/dist/js/bundle.js
  2. +8 −0 client/src/components/Search/Search.js
  3. +1 −14 client/src/components/SearchableDropdownField/SearchableDropdownField.js
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
@@ -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;
}
}
});

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

/**
@@ -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);