From 7c2bfe68e6aba6ca11022ff50e57da6e142db775 Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Wed, 5 Feb 2020 16:08:40 -0800 Subject: [PATCH 1/3] Fix variable explorer when restarting a kernel (#9931) * Make sure to clear variable list on reset * Add news entry --- news/2 Fixes/9740.md | 1 + .../interactive-common/redux/reducers/variables.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 news/2 Fixes/9740.md diff --git a/news/2 Fixes/9740.md b/news/2 Fixes/9740.md new file mode 100644 index 000000000000..30bb6f62d107 --- /dev/null +++ b/news/2 Fixes/9740.md @@ -0,0 +1 @@ +Make sure to clear variable list on restart kernel. \ No newline at end of file diff --git a/src/datascience-ui/interactive-common/redux/reducers/variables.ts b/src/datascience-ui/interactive-common/redux/reducers/variables.ts index f48cf215b90a..caeb3e76006d 100644 --- a/src/datascience-ui/interactive-common/redux/reducers/variables.ts +++ b/src/datascience-ui/interactive-common/redux/reducers/variables.ts @@ -22,7 +22,7 @@ type VariableReducerFunc = ReducerFunc = ReducerArg; function handleRequest(arg: VariableReducerArg): IVariableState { - const newExecutionCount = arg.payload.executionCount ? arg.payload.executionCount : arg.prevState.currentExecutionCount; + const newExecutionCount = arg.payload.executionCount !== undefined ? arg.payload.executionCount : arg.prevState.currentExecutionCount; arg.queueAction( createPostableAction(InteractiveWindowMessages.GetVariablesRequest, { executionCount: newExecutionCount, @@ -108,7 +108,12 @@ function handleResponse(arg: VariableReducerArg): IVa function handleRestarted(arg: VariableReducerArg): IVariableState { // If the variables are visible, refresh them if (arg.prevState.visible) { - return handleRequest({ ...arg, payload: { executionCount: 0, sortColumn: 'name', sortAscending: true, startIndex: 0, pageSize: arg.prevState.pageSize } }); + const result = handleRequest({ ...arg, payload: { executionCount: 0, sortColumn: 'name', sortAscending: true, startIndex: 0, pageSize: arg.prevState.pageSize } }); + return { + ...result, + currentExecutionCount: 0, + variables: [] + }; } return arg.prevState; } From 8edb7cf4640a238b1f075f4b5957ee8f7e037512 Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Wed, 5 Feb 2020 16:13:03 -0800 Subject: [PATCH 2/3] Update changelog --- news/2 Fixes/9740.md | 1 - 1 file changed, 1 deletion(-) delete mode 100644 news/2 Fixes/9740.md diff --git a/news/2 Fixes/9740.md b/news/2 Fixes/9740.md deleted file mode 100644 index 30bb6f62d107..000000000000 --- a/news/2 Fixes/9740.md +++ /dev/null @@ -1 +0,0 @@ -Make sure to clear variable list on restart kernel. \ No newline at end of file From a19d6556beae474e17da8b8679003610315e6adb Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Wed, 5 Feb 2020 16:13:13 -0800 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bcdbb6a4e472..fa6f4cae02f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,8 @@ ### Fixes +1. Make sure to clear variable list on restart kernel. + ([#9740](https://github.com/Microsoft/vscode-python/issues/9740)) 1. Removed unnecessary warning when executing cells that use Scrapbook, Fix an html crash when using not supported mime types ([#9796](https://github.com/microsoft/vscode-python/issues/9796)) @@ -4964,4 +4966,4 @@ the following people who contributed code: * Added ability to view global variables, arguments, add and remove break points ## Version 0.0.3 -* Added support for debugging using PDB +* Added support for debugging using PDB \ No newline at end of file