From cccee20689c409b922f3d9ec1687ca38b2918e86 Mon Sep 17 00:00:00 2001 From: Samuel Reed Date: Thu, 14 Apr 2016 14:17:31 -0500 Subject: [PATCH] Minimize initial shunting on mount. Part of a fix for #212 --- lib/ReactGridLayout.jsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/ReactGridLayout.jsx b/lib/ReactGridLayout.jsx index ba0ecc99a..f48e20a01 100644 --- a/lib/ReactGridLayout.jsx +++ b/lib/ReactGridLayout.jsx @@ -9,7 +9,6 @@ import GridItem from './GridItem'; import type {ResizeEvent, DragEvent, Layout, LayoutItem} from './utils'; type State = { activeDrag: ?LayoutItem, - isMounted: boolean, layout: Layout, oldDragItem: ?LayoutItem, oldResizeItem: ?LayoutItem @@ -145,7 +144,6 @@ export default class ReactGridLayout extends React.Component { state: State = { activeDrag: null, - isMounted: false, layout: synchronizeLayoutWithChildren(this.props.layout, this.props.children, this.props.cols, this.props.verticalCompact), oldDragItem: null, @@ -161,7 +159,6 @@ export default class ReactGridLayout extends React.Component { // Call back with layout on mount. This should be done after correcting the layout width // to ensure we don't rerender with the wrong width. this.props.onLayoutChange(this.state.layout); - this.setState({isMounted: true}); } componentWillReceiveProps(nextProps: Object) { @@ -365,6 +362,8 @@ export default class ReactGridLayout extends React.Component { // Parse 'static'. Any properties defined directly on the grid item will take precedence. const draggable = Boolean(!l.static && isDraggable && (l.isDraggable || l.isDraggable == null)); const resizable = Boolean(!l.static && isResizable && (l.isResizable || l.isResizable == null)); + // $FlowIgnore + const isBrowser = process.browser; return (