Skip to content

Commit

Permalink
Use context instead of consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
VladLasitsa committed Nov 19, 2020
1 parent 9434271 commit 4504020
Showing 1 changed file with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { QueryBarWrapper } from '../query_bar_wrapper';
import { getDefaultQueryLanguage } from '../lib/get_default_query_language';
import { VisDataContext } from './../../contexts/vis_data_context';
export class TablePanelConfig extends Component {
static contextType = VisDataContext;
constructor(props) {
super(props);
this.state = { selectedTab: 'data' };
Expand Down Expand Up @@ -116,19 +117,15 @@ export class TablePanelConfig extends Component {
/>
}
>
<VisDataContext.Consumer>
{(visData) => (
<FieldSelect
fields={this.props.fields}
value={model.pivot_id}
indexPattern={model.index_pattern}
onChange={this.handlePivotChange}
uiRestrictions={visData.uiRestrictions}
type={'terms'}
fullWidth
/>
)}
</VisDataContext.Consumer>
<FieldSelect
fields={this.props.fields}
value={model.pivot_id}
indexPattern={model.index_pattern}
onChange={this.handlePivotChange}
uiRestrictions={this.context.uiRestrictions}
type={'terms'}
fullWidth
/>
</EuiFormRow>
</EuiFlexItem>
<EuiFlexItem>
Expand Down

0 comments on commit 4504020

Please sign in to comment.