Commit c47c2528 by Johannes Schill

Revert "chore: Replace sizeMe with AutoSizer in DashboardGrid"

This reverts commit ae0b027d.
parent 9c64e3b4
...@@ -5,12 +5,13 @@ import { GRID_CELL_HEIGHT, GRID_CELL_VMARGIN, GRID_COLUMN_COUNT } from 'app/core ...@@ -5,12 +5,13 @@ import { GRID_CELL_HEIGHT, GRID_CELL_VMARGIN, GRID_COLUMN_COUNT } from 'app/core
import { DashboardPanel } from './DashboardPanel'; import { DashboardPanel } from './DashboardPanel';
import { DashboardModel, PanelModel } from '../state'; import { DashboardModel, PanelModel } from '../state';
import classNames from 'classnames'; import classNames from 'classnames';
import { AutoSizer } from 'react-virtualized'; import sizeMe from 'react-sizeme';
let lastGridWidth = 1200; let lastGridWidth = 1200;
let ignoreNextWidthChange = false; let ignoreNextWidthChange = false;
interface SizedReactLayoutGridProps { interface GridWrapperProps {
size: { width: number; };
layout: ReactGridLayout.Layout[]; layout: ReactGridLayout.Layout[];
onLayoutChange: (layout: ReactGridLayout.Layout[]) => void; onLayoutChange: (layout: ReactGridLayout.Layout[]) => void;
children: JSX.Element | JSX.Element[]; children: JSX.Element | JSX.Element[];
...@@ -24,12 +25,8 @@ interface SizedReactLayoutGridProps { ...@@ -24,12 +25,8 @@ interface SizedReactLayoutGridProps {
isFullscreen?: boolean; isFullscreen?: boolean;
} }
interface GridWrapperProps extends SizedReactLayoutGridProps {
sizedWidth: number;
}
function GridWrapper({ function GridWrapper({
sizedWidth, size,
layout, layout,
onLayoutChange, onLayoutChange,
children, children,
...@@ -41,8 +38,8 @@ function GridWrapper({ ...@@ -41,8 +38,8 @@ function GridWrapper({
isResizable, isResizable,
isDraggable, isDraggable,
isFullscreen, isFullscreen,
}: GridWrapperProps) { }: GridWrapperProps) {
const width = sizedWidth > 0 ? sizedWidth : lastGridWidth; const width = size.width > 0 ? size.width : lastGridWidth;
// logic to ignore width changes (optimization) // logic to ignore width changes (optimization)
if (width !== lastGridWidth) { if (width !== lastGridWidth) {
...@@ -77,16 +74,7 @@ function GridWrapper({ ...@@ -77,16 +74,7 @@ function GridWrapper({
); );
} }
const SizedReactLayoutGrid = (props: SizedReactLayoutGridProps) => ( const SizedReactLayoutGrid = sizeMe({ monitorWidth: true })(GridWrapper);
<AutoSizer disableHeight>
{({width}) => (
<GridWrapper
sizedWidth={width}
{...props}
/>
)}
</AutoSizer>
);
export interface DashboardGridProps { export interface DashboardGridProps {
dashboard: DashboardModel; dashboard: DashboardModel;
......
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