diff --git a/CHANGELOG.md b/CHANGELOG.md index 8efcb06c40ac..c7888ea74c9b 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. Use the autoStart server when available. ([#9926](https://github.com/Microsoft/vscode-python/issues/9926)) 1. Removed unnecessary warning when executing cells that use Scrapbook, @@ -4966,4 +4968,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 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; }