Skip to content

Commit

Permalink
Fix variable explorer when restarting a kernel (#9931)
Browse files Browse the repository at this point in the history
* Make sure to clear variable list on reset

* Add news entry
  • Loading branch information
rchiodo committed Feb 6, 2020
1 parent 9f5ac3f commit 7c2bfe6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/2 Fixes/9740.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make sure to clear variable list on restart kernel.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type VariableReducerFunc<T> = ReducerFunc<IVariableState, IncomingMessageActions
type VariableReducerArg<T = never | undefined> = ReducerArg<IVariableState, IncomingMessageActions, T>;

function handleRequest(arg: VariableReducerArg<IJupyterVariablesRequest>): 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,
Expand Down Expand Up @@ -108,7 +108,12 @@ function handleResponse(arg: VariableReducerArg<IJupyterVariablesResponse>): 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;
}
Expand Down

0 comments on commit 7c2bfe6

Please sign in to comment.