mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: fixes few strict-null errors (#23775)
* Chore: fixes strict-null-error in Login > ChangePassword component * Chore: fixes strict-null-error in Login > LoginForm component * Chore: fixes strict-null-errors in OrgActionBar component and components that render it * Chore: fixes strict-null-errors in PageHeader component * Chore: fixes strict-null-errors in PermissionList components * Chore: fixes strict-null-errors in loki language provider * Chore: fixes strict-null-errors in loki datasource * Chore: fixes strict-null-errors in panel_editor > EditorTabBody component * Chore: fixes strict-null-errors in flatten utility * Chore: fixes strict-null-errors in search component * Chore: fixes strict-null-errors in SharedPreferences component * Chore: fixes strict-null-errors in MetricSelect component * Chore: updates type on a param to type on argument * Chore: updates strict-null errors count from 791 to 757 * Chore: updates PageHeader - adds null checks * Chore: updates PageHeader - updates null checks * Chore: updates PageHeader null checks to longer format * Chore: updates strict-null fixes * Chore: updates error count limit in ci-frontend-metrics
This commit is contained in:
@@ -37,7 +37,7 @@ export class MetricSelect extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||
if (nextProps.options.length > 0 || nextProps.variables.length) {
|
||||
if (nextProps.options.length > 0 || nextProps.variables?.length) {
|
||||
this.setState({ options: this.buildOptions(nextProps) });
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ export class MetricSelect extends React.Component<Props, State> {
|
||||
getVariablesGroup() {
|
||||
return {
|
||||
label: 'Template Variables',
|
||||
options: this.props.variables.map(v => ({
|
||||
options: this.props.variables?.map(v => ({
|
||||
label: `$${v.name}`,
|
||||
value: `$${v.name}`,
|
||||
})),
|
||||
@@ -77,7 +77,7 @@ export class MetricSelect extends React.Component<Props, State> {
|
||||
isMulti={false}
|
||||
isClearable={false}
|
||||
backspaceRemovesValue={false}
|
||||
onChange={item => onChange(item.value)}
|
||||
onChange={item => onChange(item.value ?? '')}
|
||||
options={options}
|
||||
isSearchable={isSearchable}
|
||||
maxMenuHeight={500}
|
||||
|
||||
Reference in New Issue
Block a user