File tree Expand file tree Collapse file tree
x-pack/plugins/ml/public/application/explorer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import { i18n } from '@kbn/i18n';
1414import { FormattedMessage } from '@kbn/i18n/react' ;
1515import DragSelect from 'dragselect/dist/ds.min.js' ;
1616import { Subject } from 'rxjs' ;
17- import { map , takeUntil } from 'rxjs/operators' ;
17+ import { takeUntil } from 'rxjs/operators' ;
1818
1919import {
2020 EuiFlexGroup ,
@@ -169,12 +169,7 @@ export class Explorer extends React.Component {
169169 } ;
170170
171171 componentDidMount ( ) {
172- limit$
173- . pipe (
174- takeUntil ( this . _unsubscribeAll ) ,
175- map ( d => d . val )
176- )
177- . subscribe ( explorerService . setSwimlaneLimit ) ;
172+ limit$ . pipe ( takeUntil ( this . _unsubscribeAll ) ) . subscribe ( explorerService . setSwimlaneLimit ) ;
178173
179174 // Required to redraw the time series chart when the container is resized.
180175 this . resizeChecker = new ResizeChecker ( this . resizeRef . current ) ;
Original file line number Diff line number Diff line change @@ -9,8 +9,6 @@ import { act } from 'react-dom/test-utils';
99import { shallow } from 'enzyme' ;
1010import { SelectLimit } from './select_limit' ;
1111
12- jest . useFakeTimers ( ) ;
13-
1412describe ( 'SelectLimit' , ( ) => {
1513 test ( 'creates correct initial selected value' , ( ) => {
1614 const wrapper = shallow ( < SelectLimit /> ) ;
Original file line number Diff line number Diff line change 99 */
1010import React from 'react' ;
1111import useObservable from 'react-use/lib/useObservable' ;
12- import { Subject } from 'rxjs' ;
12+ import { BehaviorSubject } from 'rxjs' ;
1313
1414import { EuiSelect } from '@elastic/eui' ;
1515
@@ -20,13 +20,13 @@ const euiOptions = limitOptions.map(limit => ({
2020 text : `${ limit } ` ,
2121} ) ) ;
2222
23- export const limit$ = new Subject < number > ( ) ;
2423export const defaultLimit = limitOptions [ 1 ] ;
24+ export const limit$ = new BehaviorSubject < number > ( defaultLimit ) ;
2525
2626export const useSwimlaneLimit = ( ) : [ number , ( newLimit : number ) => void ] => {
2727 const limit = useObservable ( limit$ , defaultLimit ) ;
2828
29- return [ limit , ( newLimit : number ) => limit$ . next ( newLimit ) ] ;
29+ return [ limit ! , ( newLimit : number ) => limit$ . next ( newLimit ) ] ;
3030} ;
3131
3232export const SelectLimit = ( ) => {
You can’t perform that action at this time.
0 commit comments