File tree Expand file tree Collapse file tree 3 files changed +22
-20
lines changed
client/datascience/interactive-ipynb
datascience-ui/interactive-common/redux/reducers Expand file tree Collapse file tree 3 files changed +22
-20
lines changed Original file line number Diff line number Diff line change
1
+ Clear variables in notebooks and interactive-window when restarting.
Original file line number Diff line number Diff line change @@ -355,7 +355,12 @@ export class NativeEditor extends InteractiveBase implements INotebookEditor {
355
355
return this . setDirty ( ) ;
356
356
}
357
357
358
- protected addSysInfo ( _reason : SysInfoReason ) : Promise < void > {
358
+ protected addSysInfo ( reason : SysInfoReason ) : Promise < void > {
359
+ // We need to send a message when restarting
360
+ if ( reason === SysInfoReason . Restart || reason === SysInfoReason . New ) {
361
+ this . postMessage ( InteractiveWindowMessages . RestartKernel ) . ignoreErrors ( ) ;
362
+ }
363
+
359
364
// These are not supported.
360
365
return Promise . resolve ( ) ;
361
366
}
Original file line number Diff line number Diff line change @@ -118,25 +118,21 @@ function handleResponse(arg: VariableReducerArg<IJupyterVariablesResponse>): IVa
118
118
}
119
119
120
120
function handleRestarted ( arg : VariableReducerArg ) : IVariableState {
121
- // If the variables are visible, refresh them
122
- if ( arg . prevState . visible ) {
123
- const result = handleRequest ( {
124
- ...arg ,
125
- payload : {
126
- executionCount : 0 ,
127
- sortColumn : 'name' ,
128
- sortAscending : true ,
129
- startIndex : 0 ,
130
- pageSize : arg . prevState . pageSize
131
- }
132
- } ) ;
133
- return {
134
- ...result ,
135
- currentExecutionCount : 0 ,
136
- variables : [ ]
137
- } ;
138
- }
139
- return arg . prevState ;
121
+ const result = handleRequest ( {
122
+ ...arg ,
123
+ payload : {
124
+ executionCount : 0 ,
125
+ sortColumn : 'name' ,
126
+ sortAscending : true ,
127
+ startIndex : 0 ,
128
+ pageSize : arg . prevState . pageSize
129
+ }
130
+ } ) ;
131
+ return {
132
+ ...result ,
133
+ currentExecutionCount : 0 ,
134
+ variables : [ ]
135
+ } ;
140
136
}
141
137
142
138
function handleFinishCell ( arg : VariableReducerArg < ICell > ) : IVariableState {
You can’t perform that action at this time.
0 commit comments