Commit add2e444 by Torkel Ödegaard Committed by GitHub

Merge pull request #13849 from grafana/mode-change-performance-changes

Reduce re-renderings when changing view modes
parents 10e5d725 c5f9d809
...@@ -21,16 +21,15 @@ function GridWrapper({ ...@@ -21,16 +21,15 @@ function GridWrapper({
className, className,
isResizable, isResizable,
isDraggable, isDraggable,
isFullscreen,
}) { }) {
if (size.width === 0) {
console.log('size is zero!');
}
const width = size.width > 0 ? size.width : lastGridWidth; const width = size.width > 0 ? size.width : lastGridWidth;
if (width !== lastGridWidth) { if (width !== lastGridWidth) {
if (!isFullscreen && Math.abs(width - lastGridWidth) > 8) {
onWidthChange(); onWidthChange();
lastGridWidth = width; lastGridWidth = width;
} }
}
return ( return (
<ReactGridLayout <ReactGridLayout
...@@ -197,6 +196,7 @@ export class DashboardGrid extends React.Component<DashboardGridProps, any> { ...@@ -197,6 +196,7 @@ export class DashboardGrid extends React.Component<DashboardGridProps, any> {
onDragStop={this.onDragStop} onDragStop={this.onDragStop}
onResize={this.onResize} onResize={this.onResize}
onResizeStop={this.onResizeStop} onResizeStop={this.onResizeStop}
isFullscreen={this.props.dashboard.meta.fullscreen}
> >
{this.renderPanels()} {this.renderPanels()}
</SizedReactLayoutGrid> </SizedReactLayoutGrid>
......
...@@ -36,7 +36,11 @@ export class Graph2 extends PureComponent<Props> { ...@@ -36,7 +36,11 @@ export class Graph2 extends PureComponent<Props> {
export class TextOptions extends PureComponent<any> { export class TextOptions extends PureComponent<any> {
render() { render() {
return <p>Text2 Options component</p>; return (
<div className="section gf-form-group">
<h5 className="section-heading">Draw Modes</h5>
</div>
);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment