>
@@ -206,12 +204,12 @@ export default class Storage extends React.PureComponent {
- {i + 1 < this._listNowLen && (
+ {i + 1 < this.props.listNow.length && (
)}
- {i + 1 === this._listNowLen && i + 1 < this._listLen && (
+ {i + 1 === this.props.listNow.length && i + 1 < this.props.list.length && (
@@ -227,15 +225,18 @@ export default class Storage extends React.PureComponent {
// this.renderItem(item, i, i > 0 ? listNow[i - 1] : undefined, listNowLen, listLen)
// )
const { listNow } = this.props;
+
+ if (!listNow[index]) return console.warn(index, listNow)
+
return (
- {this.renderItem(listNow[index], index, index > 0 ? listNow[index - 1] : undefined, style)}
+ {({ measure }) => this.renderItem(listNow[index], index, index > 0 ? listNow[index - 1] : undefined, style, measure)}
)
}
@@ -345,20 +346,20 @@ export default class Storage extends React.PureComponent {
)}
- {({ height, width }) => (
+ {({ height, width }) => (
{
this._list = element;
}}
deferredMeasurementCache={this.cache}
- overscanRowCount={2}
- rowCount={this._listNowLen}
- rowHeight={this.cache.rowHeight}
+ overscanRowCount={1}
+ rowCount={Math.ceil(parseInt(this.props.listNow.length) || 1)}
+ rowHeight={ROW_HEIGHT}
rowRenderer={this._rowRenderer}
width={width}
height={height}
/>
- )}
+ )}
diff --git a/frontend/app/components/shared/DevTools/ConsolePanel/ConsolePanel.tsx b/frontend/app/components/shared/DevTools/ConsolePanel/ConsolePanel.tsx
index 361084221..320f76341 100644
--- a/frontend/app/components/shared/DevTools/ConsolePanel/ConsolePanel.tsx
+++ b/frontend/app/components/shared/DevTools/ConsolePanel/ConsolePanel.tsx
@@ -8,6 +8,12 @@ import { Tabs, Input, Icon, NoContent } from 'UI';
import cn from 'classnames';
import ConsoleRow from '../ConsoleRow';
import { getRE } from 'App/utils';
+import {
+ List,
+ CellMeasurer,
+ CellMeasurerCache,
+ AutoSizer,
+} from 'react-virtualized';
const ALL = 'ALL';
const INFO = 'INFO';
@@ -62,6 +68,34 @@ function ConsolePanel(props: Props) {
const [activeTab, setActiveTab] = useState(ALL);
const [filter, setFilter] = useState('');
+ const cache = new CellMeasurerCache({
+ fixedWidth: true,
+ keyMapper: (index: number) => filtered[index],
+ });
+ const _list = React.useRef();
+
+ const _rowRenderer = ({ index, key, parent, style }: any) => {
+ const item = filtered[index];
+
+ return (
+
+ {({ measure }: any) => (
+ {
+ measure();
+ (_list as any).current.recomputeRowHeights(index);
+ }}
+ />
+ )}
+
+ );
+ };
+
let filtered = React.useMemo(() => {
const filterRE = getRE(filter, 'i');
let list = logs;
@@ -105,17 +139,20 @@ function ConsolePanel(props: Props) {
size="small"
show={filtered.length === 0}
>
- {/*
*/}
- {filtered.map((l: any, index: any) => (
-
- ))}
- {/* */}
+
+ {({ height, width }: any) => (
+
+ )}
+
diff --git a/frontend/app/components/shared/DevTools/ConsoleRow/ConsoleRow.tsx b/frontend/app/components/shared/DevTools/ConsoleRow/ConsoleRow.tsx
index f52be65cd..aae911d42 100644
--- a/frontend/app/components/shared/DevTools/ConsoleRow/ConsoleRow.tsx
+++ b/frontend/app/components/shared/DevTools/ConsoleRow/ConsoleRow.tsx
@@ -10,9 +10,11 @@ interface Props {
iconProps: any;
jump?: any;
renderWithNL?: any;
+ style?: any;
+ recalcHeight?: () => void;
}
function ConsoleRow(props: Props) {
- const { log, iconProps, jump, renderWithNL } = props;
+ const { log, iconProps, jump, renderWithNL, style, recalcHeight } = props;
const { showModal } = useModal();
const [expanded, setExpanded] = useState(false);
const lines = log.value.split('\n').filter((l: any) => !!l);
@@ -23,8 +25,14 @@ function ConsoleRow(props: Props) {
const onErrorClick = () => {
showModal(
, { right: true });
};
+
+ const toggleExpand = () => {
+ setExpanded(!expanded)
+ setTimeout(() => recalcHeight(), 0)
+ }
return (
(!!log.errorId ? onErrorClick() : setExpanded(!expanded)) : () => {}
+ clickable ? () => (!!log.errorId ? onErrorClick() : toggleExpand()) : () => {}
}
>
@@ -49,7 +57,7 @@ function ConsoleRow(props: Props) {
)}
{renderWithNL(lines.pop())}
- {canExpand && expanded && lines.map((l: any) =>
{l}
)}
+ {canExpand && expanded && lines.map((l: string, i: number) =>
{l}
)}
jump(log.time)} />
diff --git a/frontend/app/components/ui/JSONTree/JSONTree.js b/frontend/app/components/ui/JSONTree/JSONTree.js
index dc6ab786c..b94324ebd 100644
--- a/frontend/app/components/ui/JSONTree/JSONTree.js
+++ b/frontend/app/components/ui/JSONTree/JSONTree.js
@@ -8,7 +8,7 @@ function updateObjectLink(obj) {
}
export default ({ src, ...props }) => (
-