Enable code generation when a single block is run in the debugger (#3694)
This commit is contained in:
@@ -415,6 +415,18 @@ function Workspace({
|
|||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isFinalized) {
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ["block-scripts"],
|
||||||
|
});
|
||||||
|
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: ["cache-key-values"],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [isFinalized, queryClient, workflowRun]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
blockScriptStore.setScripts(blockScriptsPublished ?? {});
|
blockScriptStore.setScripts(blockScriptsPublished ?? {});
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import { useNodeLabelChangeHandler } from "@/routes/workflows/hooks/useLabelChan
|
|||||||
import { useDeleteNodeCallback } from "@/routes/workflows/hooks/useDeleteNodeCallback";
|
import { useDeleteNodeCallback } from "@/routes/workflows/hooks/useDeleteNodeCallback";
|
||||||
import { useToggleScriptForNodeCallback } from "@/routes/workflows/hooks/useToggleScriptForNodeCallback";
|
import { useToggleScriptForNodeCallback } from "@/routes/workflows/hooks/useToggleScriptForNodeCallback";
|
||||||
import { useDebugSessionQuery } from "@/routes/workflows/hooks/useDebugSessionQuery";
|
import { useDebugSessionQuery } from "@/routes/workflows/hooks/useDebugSessionQuery";
|
||||||
|
import { useWorkflowQuery } from "@/routes/workflows/hooks/useWorkflowQuery";
|
||||||
import { useWorkflowRunQuery } from "@/routes/workflows/hooks/useWorkflowRunQuery";
|
import { useWorkflowRunQuery } from "@/routes/workflows/hooks/useWorkflowRunQuery";
|
||||||
import {
|
import {
|
||||||
debuggableWorkflowBlockTypes,
|
debuggableWorkflowBlockTypes,
|
||||||
@@ -67,6 +68,7 @@ type Payload = Record<string, unknown> & {
|
|||||||
totp_url: string | null;
|
totp_url: string | null;
|
||||||
webhook_url: string | null;
|
webhook_url: string | null;
|
||||||
workflow_id: string;
|
workflow_id: string;
|
||||||
|
code_gen: boolean | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getPayload = (opts: {
|
const getPayload = (opts: {
|
||||||
@@ -171,6 +173,9 @@ function NodeHeader({
|
|||||||
const { data: debugSession } = useDebugSessionQuery({
|
const { data: debugSession } = useDebugSessionQuery({
|
||||||
workflowPermanentId,
|
workflowPermanentId,
|
||||||
});
|
});
|
||||||
|
const { data: workflow } = useWorkflowQuery({
|
||||||
|
workflowPermanentId,
|
||||||
|
});
|
||||||
const saveWorkflow = useWorkflowSave();
|
const saveWorkflow = useWorkflowSave();
|
||||||
|
|
||||||
const thisBlockIsPlaying =
|
const thisBlockIsPlaying =
|
||||||
@@ -458,7 +463,10 @@ function NodeHeader({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const handleOnPlay = () => {
|
const handleOnPlay = () => {
|
||||||
runBlock.mutate({ codeGen: false });
|
const numBlocksInWorkflow = (workflow?.workflow_definition.blocks ?? [])
|
||||||
|
.length;
|
||||||
|
|
||||||
|
runBlock.mutate({ codeGen: numBlocksInWorkflow === 1 });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOnCancel = () => {
|
const handleOnCancel = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user