Skip to content

Commit b0e2d19

Browse files
authored
fix: should not clear log for non-user running (#1244)
Signed-off-by: Wei Wu <[email protected]>
1 parent 00ff483 commit b0e2d19

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

client/src/components/logViewer/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,11 @@ useRunStore.subscribe(
110110
} else if (isExecuting && !prevIsExecuting) {
111111
setProducedExecutionLogOutput(false);
112112

113-
if (clearLogOnExecutionStart() && outputChannel) {
113+
if (
114+
clearLogOnExecutionStart() &&
115+
outputChannel &&
116+
useRunStore.getState().isUserExecuting
117+
) {
114118
outputChannel.dispose();
115119
outputChannel = undefined;
116120
data = [];

client/src/connection/itc/CodeRunner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ async function _runCode(
3737
}
3838

3939
const { setIsExecutingCode } = useRunStore.getState();
40-
setIsExecutingCode(true);
40+
setIsExecutingCode(true, false);
4141
commands.executeCommand("setContext", "SAS.running", true);
4242
const session = getSession();
4343

client/src/store/run/actions.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ import { StateCreator } from "zustand/vanilla";
55
import { type Store } from "./store";
66

77
export interface RunActions {
8-
setIsExecutingCode: (isExecuting: boolean) => void;
8+
setIsExecutingCode: (isExecuting: boolean, isUserExecuting?: boolean) => void;
99
}
1010

1111
export const createRunActions: StateCreator<Store, [], [], RunActions> = (
1212
set,
1313
) => ({
14-
setIsExecutingCode: (isExecutingCode) => {
14+
setIsExecutingCode: (isExecutingCode, isUserExecuting = true) => {
1515
set({
1616
isExecutingCode,
17+
isUserExecuting,
1718
});
1819
},
1920
});

client/src/store/run/initialState.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
// SPDX-License-Identifier: Apache-2.0
33
export interface RunState {
44
isExecutingCode: boolean;
5+
isUserExecuting: boolean;
56
}
67

78
export const initialState: RunState = {
89
isExecutingCode: false,
10+
isUserExecuting: false,
911
};

client/test/store/run/actions.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ describe("run actions", () => {
1212
const { setIsExecutingCode } = useRunStore.getState();
1313
const expectedState: RunState = {
1414
isExecutingCode: true,
15+
isUserExecuting: true,
1516
};
1617

1718
setIsExecutingCode(true);

0 commit comments

Comments
 (0)