This commit is contained in:
@@ -267,9 +267,12 @@ function NodeHeader({
|
|||||||
|
|
||||||
const cancelBlock = useMutation({
|
const cancelBlock = useMutation({
|
||||||
mutationFn: async () => {
|
mutationFn: async () => {
|
||||||
|
const browserSessionId =
|
||||||
|
debugStore.getCurrentBrowserSessionId() ??
|
||||||
|
"<missing-browser-session-id>";
|
||||||
const client = await getClient(credentialGetter);
|
const client = await getClient(credentialGetter);
|
||||||
return client
|
return client
|
||||||
.post(`/workflows/runs/${workflowRunId}/cancel`)
|
.post(`/runs/${browserSessionId}/workflow_run/${workflowRunId}/cancel/`)
|
||||||
.then((response) => response.data);
|
.then((response) => response.data);
|
||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import React, { createContext, useMemo } from "react";
|
import React, { createContext, useMemo } from "react";
|
||||||
import { useLocation } from "react-router-dom";
|
import { useLocation } from "react-router-dom";
|
||||||
|
import { lsKeys } from "@/util/env";
|
||||||
|
|
||||||
function useIsDebugMode() {
|
function useIsDebugMode() {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
@@ -9,8 +10,23 @@ function useIsDebugMode() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCurrentBrowserSessionId() {
|
||||||
|
const stored = localStorage.getItem(lsKeys.optimisticBrowserSession);
|
||||||
|
let browserSessionId: string | null = null;
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(stored ?? "");
|
||||||
|
const { browser_session_id } = parsed;
|
||||||
|
browserSessionId = browser_session_id as string;
|
||||||
|
} catch {
|
||||||
|
// pass
|
||||||
|
}
|
||||||
|
|
||||||
|
return browserSessionId;
|
||||||
|
}
|
||||||
|
|
||||||
export type DebugStoreContextType = {
|
export type DebugStoreContextType = {
|
||||||
isDebugMode: boolean;
|
isDebugMode: boolean;
|
||||||
|
getCurrentBrowserSessionId: () => string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DebugStoreContext = createContext<
|
export const DebugStoreContext = createContext<
|
||||||
@@ -23,7 +39,9 @@ export const DebugStoreProvider: React.FC<{ children: React.ReactNode }> = ({
|
|||||||
const isDebugMode = useIsDebugMode();
|
const isDebugMode = useIsDebugMode();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DebugStoreContext.Provider value={{ isDebugMode }}>
|
<DebugStoreContext.Provider
|
||||||
|
value={{ isDebugMode, getCurrentBrowserSessionId }}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</DebugStoreContext.Provider>
|
</DebugStoreContext.Provider>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user