Skip to content

Fixed plots by adding extra check in transformOutput #8343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/datascience-ui/interactive-common/cellOutput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,9 @@ export class CellOutput extends React.Component<ICellOutputProps> {

private renderOutput = (outputs: nbformat.IOutput[]): JSX.Element => {
const buffer: JSX.Element[] = [];
const transformedList = outputs.map(this.transformOutput);
const transformedList = outputs.map(this.transformOutput.bind(this));

transformedList.forEach(transformed => {
transformedList.forEach((transformed, index) => {
let mimetype = transformed.mimeType;

// If that worked, use the transform
Expand All @@ -367,7 +367,7 @@ export class CellOutput extends React.Component<ICellOutputProps> {
// If we are not theming plots then wrap them in a white span
if (transformed.outputSpanClassName) {
buffer.push(
<div role='group' onDoubleClick={transformed.doubleClick} onClick={this.click} className={className}>
<div role='group' key={index} onDoubleClick={transformed.doubleClick} onClick={this.click} className={className}>
<span className={transformed.outputSpanClassName}>
{transformed.extraButton}
<Transform data={transformed.data} />
Expand All @@ -376,7 +376,7 @@ export class CellOutput extends React.Component<ICellOutputProps> {
);
} else {
buffer.push(
<div role='group' onDoubleClick={transformed.doubleClick} onClick={this.click} className={className}>
<div role='group' key={index} onDoubleClick={transformed.doubleClick} onClick={this.click} className={className}>
{transformed.extraButton}
<Transform data={transformed.data} />
</div>
Expand All @@ -390,7 +390,7 @@ export class CellOutput extends React.Component<ICellOutputProps> {
mimetype = 'unknown';
}
const str: string = this.getUnknownMimeTypeFormatString().format(mimetype);
buffer.push(<div>{str}</div>);
buffer.push(<div key={index}>{str}</div>);
}
});

Expand All @@ -404,6 +404,6 @@ export class CellOutput extends React.Component<ICellOutputProps> {
style.maxHeight = `${this.props.maxTextSize}px`;
}

return <div style={style}>{buffer}</div>;
return <div key={0} style={style}>{buffer}</div>;
}
}