Skip to content

Concat uiSideErrors in Cell output #11364

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
Apr 23, 2020
Merged
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion src/datascience-ui/interactive-common/cellOutput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ export class CellOutput extends React.Component<ICellOutputProps> {
if (nextProps.cellVM.cell.data.outputs !== this.props.cellVM.cell.data.outputs) {
return true;
}
if (nextProps.cellVM.uiSideError !== this.props.cellVM.uiSideError) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what was missing, the first time we rendered a cell errors wouldn't get dispalyed, have to run again (as pointed out by @rich)

return true;
}
if (
!this.isCodeCell() &&
nextProps.cellVM.cell.id !== Identifiers.EditCellId &&
Expand Down Expand Up @@ -272,7 +275,7 @@ export class CellOutput extends React.Component<ICellOutputProps> {
// tslint:disable: react-no-dangerous-html
if (this.props.cellVM.uiSideError) {
outputs.push(
<div className="cell-output-uiSideError">
<div key={'uiError'} className="cell-output-uiSideError">
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Key required by react.

<div dangerouslySetInnerHTML={{ __html: this.props.cellVM.uiSideError }} />
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,11 @@ export namespace CommonEffects {
"Widgets require us to download supporting files from a 3rd party website. Click <a href='https://command:python.datascience.enableLoadingWidgetScriptsFromThirdPartySource'>here</a> to enable this or click <a href='https://aka.ms/PVSCIPyWidgets'>here</a> for more information. (Error loading {0}:{1})."
).format(arg.payload.data.moduleName, arg.payload.data.moduleVersion);
}
// Preserve existing error messages.
const existingErrorMessage = current.uiSideError ? `${current.uiSideError}\n` : '';
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure we concat errors.
If we have more than one widget in same cell last error wins.
This way all errors are displayed, also applies in the case of qgrid.

newVMs[index] = Helpers.asCellViewModel({
...current,
uiSideError: errorMessage
uiSideError: `${existingErrorMessage}${errorMessage}`
});

// Make sure to tell the extension so it can log telemetry.
Expand Down