Skip to content

Commit 7d0ed6c

Browse files
authored
Port fixes into April point release (#11392)
Cherry pick the following PRs: #11248 #11276 #11249 #11280 #11364
1 parent 9d09af1 commit 7d0ed6c

File tree

16 files changed

+223
-12
lines changed

16 files changed

+223
-12
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
([#11334](https://github.com/Microsoft/vscode-python/issues/11334))
1111
1. Show unhandled widget messages in the jupyter output window.
1212
([#11239](https://github.com/Microsoft/vscode-python/issues/11239))
13+
1. Warn when using a version of the widget `qgrid` greater than `1.1.1` with the recommendation to downgrade to `1.1.1`.
14+
([#11245](https://github.com/Microsoft/vscode-python/issues/11245))
1315

1416
### Thanks
1517

package.nls.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,5 +470,6 @@
470470
"DataScience.loadThirdPartyWidgetScriptsPostEnabled": "Please restart the Kernel when changing the setting 'python.dataScience.widgetScriptSources'.",
471471
"DataScience.enableCDNForWidgetsSetting": "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}).",
472472
"DataScience.widgetScriptNotFoundOnCDNWidgetMightNotWork": "Unable to load a compatible version of the widget '{0}'. Expected behavior may be affected.",
473-
"DataScience.unhandledMessage": "Unhandled kernel message from a widget: {0} : {1}"
473+
"DataScience.unhandledMessage": "Unhandled kernel message from a widget: {0} : {1}",
474+
"DataScience.qgridWidgetScriptVersionCompatibilityWarning": "Unable to load a compatible version of the widget 'qgrid'. Consider downgrading to version 1.1.1."
474475
}

src/client/common/utils/localize.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,10 @@ export namespace DataScience {
860860
'DataScience.widgetScriptNotFoundOnCDNWidgetMightNotWork',
861861
"Unable to load a compatible version of the widget '{0}'. Expected behavior may be affected."
862862
);
863+
export const qgridWidgetScriptVersionCompatibilityWarning = localize(
864+
'DataScience.qgridWidgetScriptVersionCompatibilityWarning',
865+
"Unable to load a compatible version of the widget 'qgrid'. Consider downgrading to version 1.1.1."
866+
);
863867
}
864868

865869
export namespace DebugConfigStrings {

src/client/datascience/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ export enum Telemetry {
292292
ZMQNotSupported = 'DATASCIENCE.ZMQ_NATIVE_BINARIES_NOT_LOADING',
293293
IPyWidgetLoadSuccess = 'DS_INTERNAL.IPYWIDGET_LOAD_SUCCESS',
294294
IPyWidgetLoadFailure = 'DS_INTERNAL.IPYWIDGET_LOAD_FAILURE',
295+
IPyWidgetWidgetVersionNotSupportedLoadFailure = 'DS_INTERNAL.IPYWIDGET_WIDGET_VERSION_NOT_SUPPORTED_LOAD_FAILURE',
295296
IPyWidgetLoadDisabled = 'DS_INTERNAL.IPYWIDGET_LOAD_DISABLED',
296297
HashedIPyWidgetNameUsed = 'DS_INTERNAL.IPYWIDGET_USED_BY_USER',
297298
HashedIPyWidgetNameDiscovered = 'DS_INTERNAL.IPYWIDGET_DISCOVERED',

src/client/datascience/interactive-common/interactiveWindowTypes.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import {
1010
CommonActionType,
1111
IAddCellAction,
1212
ILoadIPyWidgetClassFailureAction,
13-
LoadIPyWidgetClassLoadAction
13+
LoadIPyWidgetClassLoadAction,
14+
NotifyIPyWidgeWidgetVersionNotSupportedAction
1415
} from '../../../datascience-ui/interactive-common/redux/reducers/types';
1516
import { PythonInterpreter } from '../../interpreter/contracts';
1617
import { WidgetScriptSource } from '../ipywidgets/types';
@@ -115,7 +116,8 @@ export enum InteractiveWindowMessages {
115116
IPyWidgetLoadSuccess = 'ipywidget_load_success',
116117
IPyWidgetLoadFailure = 'ipywidget_load_failure',
117118
IPyWidgetRenderFailure = 'ipywidget_render_failure',
118-
IPyWidgetUnhandledKernelMessage = 'ipywidget_unhandled_kernel_message'
119+
IPyWidgetUnhandledKernelMessage = 'ipywidget_unhandled_kernel_message',
120+
IPyWidgetWidgetVersionNotSupported = 'ipywidget_widget_version_not_supported'
119121
}
120122

121123
export enum IPyWidgetMessages {
@@ -607,6 +609,7 @@ export class IInteractiveWindowMapping {
607609
public [InteractiveWindowMessages.UpdateDisplayData]: KernelMessage.IUpdateDisplayDataMsg;
608610
public [InteractiveWindowMessages.IPyWidgetLoadSuccess]: LoadIPyWidgetClassLoadAction;
609611
public [InteractiveWindowMessages.IPyWidgetLoadFailure]: ILoadIPyWidgetClassFailureAction;
612+
public [InteractiveWindowMessages.IPyWidgetWidgetVersionNotSupported]: NotifyIPyWidgeWidgetVersionNotSupportedAction;
610613
public [InteractiveWindowMessages.ConvertUriForUseInWebViewRequest]: Uri;
611614
public [InteractiveWindowMessages.ConvertUriForUseInWebViewResponse]: { request: Uri; response: Uri };
612615
public [InteractiveWindowMessages.IPyWidgetRenderFailure]: Error;

src/client/datascience/interactive-common/synchronization.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ const messageWithMessageTypes: MessageMapping<IInteractiveWindowMapping> & Messa
8787
[CommonActionType.FOCUS_INPUT]: MessageType.other,
8888
[CommonActionType.LOAD_IPYWIDGET_CLASS_SUCCESS]: MessageType.other,
8989
[CommonActionType.LOAD_IPYWIDGET_CLASS_FAILURE]: MessageType.other,
90+
[CommonActionType.IPYWIDGET_WIDGET_VERSION_NOT_SUPPORTED]: MessageType.other,
9091
[CommonActionType.IPYWIDGET_RENDER_FAILURE]: MessageType.other,
9192

9293
// Types from InteractiveWindowMessages
@@ -117,6 +118,7 @@ const messageWithMessageTypes: MessageMapping<IInteractiveWindowMapping> & Messa
117118
[InteractiveWindowMessages.IPyWidgetLoadFailure]: MessageType.other,
118119
[InteractiveWindowMessages.IPyWidgetRenderFailure]: MessageType.other,
119120
[InteractiveWindowMessages.IPyWidgetUnhandledKernelMessage]: MessageType.other,
121+
[InteractiveWindowMessages.IPyWidgetWidgetVersionNotSupported]: MessageType.other,
120122
[InteractiveWindowMessages.LoadAllCells]: MessageType.other,
121123
[InteractiveWindowMessages.LoadAllCellsComplete]: MessageType.other,
122124
[InteractiveWindowMessages.LoadOnigasmAssemblyRequest]: MessageType.other,

src/client/datascience/ipywidgets/ipywidgetHandler.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import stripAnsi from 'strip-ansi';
99
import { Event, EventEmitter, Uri } from 'vscode';
1010
import {
1111
ILoadIPyWidgetClassFailureAction,
12-
LoadIPyWidgetClassLoadAction
12+
LoadIPyWidgetClassLoadAction,
13+
NotifyIPyWidgeWidgetVersionNotSupportedAction
1314
} from '../../../datascience-ui/interactive-common/redux/reducers/types';
1415
import { EnableIPyWidgets } from '../../common/experimentGroups';
1516
import { traceError, traceInfo } from '../../common/logger';
@@ -75,6 +76,8 @@ export class IPyWidgetHandler implements IInteractiveWindowListener {
7576
this.sendLoadSucceededTelemetry(payload);
7677
} else if (message === InteractiveWindowMessages.IPyWidgetLoadFailure) {
7778
this.sendLoadFailureTelemetry(payload);
79+
} else if (message === InteractiveWindowMessages.IPyWidgetWidgetVersionNotSupported) {
80+
this.sendUnsupportedWidgetVersionFailureTelemetry(payload);
7881
} else if (message === InteractiveWindowMessages.IPyWidgetRenderFailure) {
7982
this.sendRenderFailureTelemetry(payload);
8083
} else if (message === InteractiveWindowMessages.IPyWidgetUnhandledKernelMessage) {
@@ -111,6 +114,16 @@ export class IPyWidgetHandler implements IInteractiveWindowListener {
111114
// do nothing on failure
112115
}
113116
}
117+
private sendUnsupportedWidgetVersionFailureTelemetry(payload: NotifyIPyWidgeWidgetVersionNotSupportedAction) {
118+
try {
119+
sendTelemetryEvent(Telemetry.IPyWidgetWidgetVersionNotSupportedLoadFailure, 0, {
120+
moduleHash: this.hash(payload.moduleName),
121+
moduleVersion: payload.moduleVersion
122+
});
123+
} catch {
124+
// do nothing on failure
125+
}
126+
}
114127
private sendRenderFailureTelemetry(payload: Error) {
115128
try {
116129
traceError('Error rendering a widget: ', payload);

src/client/telemetry/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,6 +1992,10 @@ export interface IEventNamePropertyMapping {
19921992
// Whether we timedout getting the source of the script (fetching script source in extension code).
19931993
timedout: boolean;
19941994
};
1995+
/**
1996+
* Telemetry event sent when an ipywidget version that is not supported is used & we have trapped this and warned the user abou it.
1997+
*/
1998+
[Telemetry.IPyWidgetWidgetVersionNotSupportedLoadFailure]: { moduleHash: string; moduleVersion: string };
19951999
/**
19962000
* Telemetry event sent when an loading of 3rd party ipywidget JS scripts from 3rd party source has been disabled.
19972001
*/

src/datascience-ui/history-react/redux/reducers/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export const reducerMap: Partial<IInteractiveActionMapping> = {
4141
[CommonActionType.FOCUS_INPUT]: CommonEffects.focusInput,
4242
[CommonActionType.LOAD_IPYWIDGET_CLASS_SUCCESS]: CommonEffects.handleLoadIPyWidgetClassSuccess,
4343
[CommonActionType.LOAD_IPYWIDGET_CLASS_FAILURE]: CommonEffects.handleLoadIPyWidgetClassFailure,
44+
[CommonActionType.IPYWIDGET_WIDGET_VERSION_NOT_SUPPORTED]: CommonEffects.notifyAboutUnsupportedWidgetVersions,
4445
[CommonActionType.IPYWIDGET_RENDER_FAILURE]: CommonEffects.handleIPyWidgetRenderFailure,
4546

4647
// Messages from the webview (some are ignored)

src/datascience-ui/interactive-common/cellOutput.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ export class CellOutput extends React.Component<ICellOutputProps> {
199199
if (nextProps.cellVM.cell.data.outputs !== this.props.cellVM.cell.data.outputs) {
200200
return true;
201201
}
202+
if (nextProps.cellVM.uiSideError !== this.props.cellVM.uiSideError) {
203+
return true;
204+
}
202205
if (
203206
!this.isCodeCell() &&
204207
nextProps.cellVM.cell.id !== Identifiers.EditCellId &&
@@ -271,7 +274,7 @@ export class CellOutput extends React.Component<ICellOutputProps> {
271274
// tslint:disable: react-no-dangerous-html
272275
if (this.props.cellVM.uiSideError) {
273276
outputs.push(
274-
<div className="cell-output-uiSideError">
277+
<div key={'uiError'} className="cell-output-uiSideError">
275278
<div dangerouslySetInnerHTML={{ __html: this.props.cellVM.uiSideError }} />
276279
</div>
277280
);

0 commit comments

Comments
 (0)