From 1e5f2f56e05fc391af02c94dd57723b2bfa63dca Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Tue, 18 Dec 2018 16:56:16 +0100 Subject: [PATCH] improve component performance --- .../stackdriver/components/StackdriverPicker.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/public/app/plugins/datasource/stackdriver/components/StackdriverPicker.tsx b/public/app/plugins/datasource/stackdriver/components/StackdriverPicker.tsx index ab903c453cb..30c17e1f983 100644 --- a/public/app/plugins/datasource/stackdriver/components/StackdriverPicker.tsx +++ b/public/app/plugins/datasource/stackdriver/components/StackdriverPicker.tsx @@ -40,11 +40,8 @@ export class StackdriverPicker extends React.Component { } shouldComponentUpdate(nextProps: Props) { - return ( - nextProps.selected !== this.props.selected || - !_.isEqual(nextProps.options, this.props.options) || - !_.isEqual(nextProps.templateVariables, this.props.templateVariables) - ); + const nextOptions = this.buildOptions(nextProps); + return nextProps.selected !== this.props.selected || !_.isEqual(nextOptions, this.state.options); } buildOptions({ templateVariables = [], groupName = '', options }) { @@ -89,9 +86,7 @@ export class StackdriverPicker extends React.Component { backspaceRemovesValue={false} onChange={item => onChange(item.value)} options={options} - autoFocus={false} isSearchable={searchable} - openMenuOnFocus={true} maxMenuHeight={500} placeholder={placeholder} noOptionsMessage={() => 'No options found'}