mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Make Explore a pure component
This commit is contained in:
@@ -83,7 +83,7 @@ export interface ExploreState {
|
||||
tableResult: any;
|
||||
}
|
||||
|
||||
export class Explore extends React.Component<ExploreProps, ExploreState> {
|
||||
export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
||||
el: any;
|
||||
|
||||
constructor(props) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import React, { Component } from 'react';
|
||||
import { hot } from 'react-hot-loader';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
@@ -9,7 +9,7 @@ import { ExploreUrlState } from 'app/types/explore';
|
||||
import Explore, { ExploreState } from './Explore';
|
||||
import { DEFAULT_RANGE } from './TimePicker';
|
||||
|
||||
function parseUrlState(initial: string | undefined): ExploreUrlState {
|
||||
export function parseUrlState(initial: string | undefined): ExploreUrlState {
|
||||
if (initial) {
|
||||
try {
|
||||
return JSON.parse(decodeURI(initial));
|
||||
@@ -20,7 +20,7 @@ function parseUrlState(initial: string | undefined): ExploreUrlState {
|
||||
return { datasource: null, queries: [], range: DEFAULT_RANGE };
|
||||
}
|
||||
|
||||
function serializeStateToUrlParam(state: ExploreState): string {
|
||||
export function serializeStateToUrlParam(state: ExploreState): string {
|
||||
const urlState: ExploreUrlState = {
|
||||
datasource: state.datasourceName,
|
||||
queries: state.queries.map(q => ({ query: q.query })),
|
||||
@@ -44,7 +44,7 @@ interface WrapperState {
|
||||
const STATE_KEY_LEFT = 'state';
|
||||
const STATE_KEY_RIGHT = 'stateRight';
|
||||
|
||||
export class Wrapper extends PureComponent<WrapperProps, WrapperState> {
|
||||
export class Wrapper extends Component<WrapperProps, WrapperState> {
|
||||
urlStates: { [key: string]: string };
|
||||
|
||||
constructor(props: WrapperProps) {
|
||||
|
||||
Reference in New Issue
Block a user