Make Explore a pure component

This commit is contained in:
David Kaltschmidt
2018-09-28 17:38:50 +02:00
parent 200784ea4a
commit c3e0d4205c
2 changed files with 5 additions and 5 deletions

View File

@@ -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) {

View File

@@ -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) {