Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion client/src/components/logViewer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ useRunStore.subscribe(
} else if (isExecuting && !prevIsExecuting) {
setProducedExecutionLogOutput(false);

if (clearLogOnExecutionStart() && outputChannel) {
if (
clearLogOnExecutionStart() &&
outputChannel &&
useRunStore.getState().isUserExecuting
) {
outputChannel.dispose();
outputChannel = undefined;
data = [];
Expand Down
2 changes: 1 addition & 1 deletion client/src/connection/itc/CodeRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async function _runCode(
}

const { setIsExecutingCode } = useRunStore.getState();
setIsExecutingCode(true);
setIsExecutingCode(true, false);
commands.executeCommand("setContext", "SAS.running", true);
const session = getSession();

Expand Down
5 changes: 3 additions & 2 deletions client/src/store/run/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ import { StateCreator } from "zustand/vanilla";
import { type Store } from "./store";

export interface RunActions {
setIsExecutingCode: (isExecuting: boolean) => void;
setIsExecutingCode: (isExecuting: boolean, isUserExecuting?: boolean) => void;
}

export const createRunActions: StateCreator<Store, [], [], RunActions> = (
set,
) => ({
setIsExecutingCode: (isExecutingCode) => {
setIsExecutingCode: (isExecutingCode, isUserExecuting = true) => {
set({
isExecutingCode,
isUserExecuting,
});
},
});
2 changes: 2 additions & 0 deletions client/src/store/run/initialState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
// SPDX-License-Identifier: Apache-2.0
export interface RunState {
isExecutingCode: boolean;
isUserExecuting: boolean;
}

export const initialState: RunState = {
isExecutingCode: false,
isUserExecuting: false,
};
1 change: 1 addition & 0 deletions client/test/store/run/actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe("run actions", () => {
const { setIsExecutingCode } = useRunStore.getState();
const expectedState: RunState = {
isExecutingCode: true,
isUserExecuting: true,
};

setIsExecutingCode(true);
Expand Down