From 8c912826c0653de7f9325079263e42cae09ad3d6 Mon Sep 17 00:00:00 2001 From: Chandler Prall Date: Thu, 26 Mar 2020 15:44:11 -0600 Subject: [PATCH 1/2] Fixed EuiResizeObserver infinite disconnect call chain; fixed defaultProps setup in EuiComboBox --- .../combo_box/__snapshots__/combo_box.test.tsx.snap | 4 ---- src/components/combo_box/combo_box.tsx | 8 ++++---- .../observer/resize_observer/resize_observer.tsx | 4 ++-- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/components/combo_box/__snapshots__/combo_box.test.tsx.snap b/src/components/combo_box/__snapshots__/combo_box.test.tsx.snap index 1fbb44b9711..6d6cedcf6f5 100644 --- a/src/components/combo_box/__snapshots__/combo_box.test.tsx.snap +++ b/src/components/combo_box/__snapshots__/combo_box.test.tsx.snap @@ -381,7 +381,6 @@ exports[`props singleSelection is rendered 1`] = ` role="combobox" > * `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 @@ -178,9 +178,9 @@ export class EuiComboBox extends Component< options: [], selectedOptions: [], singleSelection: false, - prepend: null, - append: null, - sortMatchesBy: 'none', + prepend: undefined, + append: undefined, + sortMatchesBy: 'none' as const, }; state: EuiComboBoxState = { diff --git a/src/components/observer/resize_observer/resize_observer.tsx b/src/components/observer/resize_observer/resize_observer.tsx index bf10090411e..99f97aee0d2 100644 --- a/src/components/observer/resize_observer/resize_observer.tsx +++ b/src/components/observer/resize_observer/resize_observer.tsx @@ -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); }; From 4aaa572fa1a66978c1807fe3c7b3f6d131d38594 Mon Sep 17 00:00:00 2001 From: Chandler Prall Date: Thu, 26 Mar 2020 15:53:29 -0600 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c38227a9a5e..08df706649e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) ## [`22.1.0`](https://github.com/elastic/eui/tree/v22.1.0) @@ -2974,4 +2976,4 @@ instead of just string ([#516](https://github.com/elastic/eui/pull/516)) ## [`0.0.1`](https://github.com/elastic/eui/tree/v0.0.1) Initial Release -- Initial public release \ No newline at end of file +- Initial public release