Skip to content

Commit

Permalink
Fix EuiResizeObserver and EuiComboBox bugs (#3180)
Browse files Browse the repository at this point in the history
* Fixed EuiResizeObserver infinite disconnect call chain; fixed defaultProps setup in EuiComboBox

* changelog

Co-authored-by: Greg Thompson <thompson.glowe@gmail.com>
Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 27, 2020
1 parent 9eded93 commit 2fb52e2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

- Fixed EuiBasicTable proptypes of itemId ([#3133](https://github.com/elastic/eui/pull/3133))
- Updated `EuiSuperDatePicker` to inherit the selected value in quick select ([#3105](https://github.com/elastic/eui/pull/3105))
- Fixed infinite call stack in `EuiResizeObserver`'s fallback polyfill ([#3180](https://github.com/elastic/eui/pull/3180))
- Correct `defaultProps` definition in `EuiComboBox` ([#3180](https://github.com/elastic/eui/pull/3180))

### Feature: EuiCollapsibleNav ([#3019](https://github.com/elastic/eui/pull/3019))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ exports[`props singleSelection is rendered 1`] = `
role="combobox"
>
<EuiComboBoxInput
append={null}
autoSizeInputRef={[Function]}
compressed={false}
fullWidth={false}
Expand All @@ -396,7 +395,6 @@ exports[`props singleSelection is rendered 1`] = `
onFocus={[Function]}
onOpenListClick={[Function]}
onRemoveOption={[Function]}
prepend={null}
rootId={[Function]}
searchValue=""
selectedOptions={
Expand Down Expand Up @@ -552,7 +550,6 @@ exports[`props singleSelection selects existing option when opened 1`] = `
role="combobox"
>
<EuiComboBoxInput
append={null}
autoSizeInputRef={[Function]}
compressed={false}
fullWidth={false}
Expand All @@ -567,7 +564,6 @@ exports[`props singleSelection selects existing option when opened 1`] = `
onFocus={[Function]}
onOpenListClick={[Function]}
onRemoveOption={[Function]}
prepend={null}
rootId={[Function]}
searchValue=""
selectedOptions={
Expand Down
8 changes: 4 additions & 4 deletions src/components/combo_box/combo_box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ interface _EuiComboBoxProps<T>
* `startsWith`: moves items that start with search value to top of the list;
* `none`: don't change the sort order of initial object
*/
sortMatchesBy?: 'none' | 'startsWith';
sortMatchesBy: 'none' | 'startsWith';
/**
* Creates an input group with element(s) coming before input. It won't show if `singleSelection` is set to `false`.
* `string` | `ReactElement` or an array of these
Expand Down Expand Up @@ -178,9 +178,9 @@ export class EuiComboBox<T> extends Component<
options: [],
selectedOptions: [],
singleSelection: false,
prepend: null,
append: null,
sortMatchesBy: 'none',
prepend: undefined,
append: undefined,
sortMatchesBy: 'none' as const,
};

state: EuiComboBoxState<T> = {
Expand Down
4 changes: 2 additions & 2 deletions src/components/observer/resize_observer/resize_observer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ const makeCompatibleObserver = (node: Element, callback: () => void) => {

window.addEventListener('resize', callback);

const _disconnect = observer.disconnect.bind(observer);
observer.disconnect = () => {
observer.disconnect();

_disconnect();
window.removeEventListener('resize', callback);
};

Expand Down

0 comments on commit 2fb52e2

Please sign in to comment.