Skip to content

Commit

Permalink
fix: make Toolbar and Workpad pure
Browse files Browse the repository at this point in the history
neither take props, so this stops some re-rendering
  • Loading branch information
w33ble committed Feb 28, 2019
1 parent a773403 commit 82525ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion x-pack/plugins/canvas/public/components/toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { compose, withState, getContext, withHandlers } from 'recompose';
import { pure, compose, withState, getContext, withHandlers } from 'recompose';

import {
getWorkpad,
Expand All @@ -26,6 +26,7 @@ const mapStateToProps = state => ({
});

export const Toolbar = compose(
pure,
connect(mapStateToProps),
getContext({
router: PropTypes.object,
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/canvas/public/components/workpad/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { compose, withState, withProps, getContext, withHandlers } from 'recompose';
import { pure, compose, withState, withProps, getContext, withHandlers } from 'recompose';
import { transitionsRegistry } from '../../lib/transitions_registry';
import { undoHistory, redoHistory } from '../../state/actions/history';
import { fetchAllRenderables } from '../../state/actions/elements';
Expand Down Expand Up @@ -40,6 +40,7 @@ const mapDispatchToProps = {
};

export const Workpad = compose(
pure,
getContext({
router: PropTypes.object,
}),
Expand Down

0 comments on commit 82525ac

Please sign in to comment.