Chore/React18: Update context types where needed (#57018)

This commit is contained in:
kay delaney 2022-10-17 13:29:44 +01:00 committed by GitHub
parent 0d9b321058
commit b1128e0b8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 3 deletions

View File

@ -52,6 +52,7 @@ export const MenuList = (props: MenuListProps) => {
);
};
export class Select<T> extends PureComponent<LegacySelectProps<T>> {
declare context: React.ContextType<typeof ThemeContext>;
static contextType = ThemeContext;
static defaultProps: Partial<LegacySelectProps<unknown>> = {
@ -248,7 +249,7 @@ export class AsyncSelect<T> extends PureComponent<AsyncProps<T>> {
placeholder={placeholder || 'Choose'}
//@ts-expect-error
styles={resetSelectStyles(this.context)}
loadingMessage={() => loadingMessage}
loadingMessage={loadingMessage}
noOptionsMessage={noOptionsMessage}
isDisabled={isDisabled}
isSearchable={isSearchable}

View File

@ -8,7 +8,7 @@ import { config, locationService } from '@grafana/runtime';
import { Themeable2, withTheme2 } from '@grafana/ui';
import { notifyApp } from 'app/core/actions';
import { Page } from 'app/core/components/Page/Page';
import { GrafanaContext } from 'app/core/context/GrafanaContext';
import { GrafanaContext, GrafanaContextType } from 'app/core/context/GrafanaContext';
import { createErrorNotification } from 'app/core/copy/appNotification';
import { getKioskMode } from 'app/core/navigation/kiosk';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
@ -98,6 +98,7 @@ export interface State {
}
export class UnthemedDashboardPage extends PureComponent<Props, State> {
declare context: GrafanaContextType;
static contextType = GrafanaContext;
private forceRouteReloadCounter = 0;

View File

@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import AutoSizer from 'react-virtualized-auto-sizer';
import { GrafanaContext } from 'app/core/context/GrafanaContext';
import { GrafanaContext, GrafanaContextType } from 'app/core/context/GrafanaContext';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
import { DashboardModel, PanelModel } from 'app/features/dashboard/state';
import { StoreState } from 'app/types';
@ -35,6 +35,7 @@ export interface State {
}
export class SoloPanelPage extends Component<Props, State> {
declare context: GrafanaContextType;
static contextType = GrafanaContext;
state: State = {

View File

@ -35,6 +35,7 @@ let isInlineEditOpen = false;
export const activePanelSubject = new ReplaySubject<SelectionAction>(1);
export class CanvasPanel extends Component<Props, State> {
declare context: React.ContextType<typeof PanelContextRoot>;
static contextType = PanelContextRoot;
panelContext: PanelContext = {} as PanelContext;

View File

@ -45,6 +45,7 @@ interface State extends OverlayProps {
}
export class GeomapPanel extends Component<Props, State> {
declare context: React.ContextType<typeof PanelContextRoot>;
static contextType = PanelContextRoot;
panelContext: PanelContext | undefined = undefined;
private subs = new Subscription();

View File

@ -19,6 +19,7 @@ interface State {
}
export class TextPanel extends PureComponent<Props, State> {
declare context: React.ContextType<typeof ThemeContext>;
static contextType = ThemeContext;
constructor(props: Props) {