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:
Lukas Siatka
2020-05-07 13:53:05 +02:00
committed by GitHub
parent bc3d5ee01d
commit 2c9eed360d
8 changed files with 40 additions and 25 deletions

View File

@@ -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}