fix(buildTrigger/index.tsx): add saveFlow function to TabsContext to save flow data before making a POST request
fix(buildTrigger/index.tsx): pass saved flow data to postBuildInit function instead of reactFlowInstance data
This commit is contained in:
parent
aa833ee6d0
commit
0edf105607
1 changed files with 6 additions and 2 deletions
|
|
@ -26,7 +26,7 @@ export default function BuildTrigger({
|
||||||
}): JSX.Element {
|
}): JSX.Element {
|
||||||
const { updateSSEData, isBuilding, setIsBuilding, sseData } = useSSE();
|
const { updateSSEData, isBuilding, setIsBuilding, sseData } = useSSE();
|
||||||
const { reactFlowInstance } = useContext(typesContext);
|
const { reactFlowInstance } = useContext(typesContext);
|
||||||
const { setTabsState } = useContext(TabsContext);
|
const { setTabsState, saveFlow } = useContext(TabsContext);
|
||||||
const { setErrorData, setSuccessData } = useContext(alertContext);
|
const { setErrorData, setSuccessData } = useContext(alertContext);
|
||||||
const [isIconTouched, setIsIconTouched] = useState(false);
|
const [isIconTouched, setIsIconTouched] = useState(false);
|
||||||
const eventClick = isBuilding ? "pointer-events-none" : "";
|
const eventClick = isBuilding ? "pointer-events-none" : "";
|
||||||
|
|
@ -76,7 +76,11 @@ export default function BuildTrigger({
|
||||||
}
|
}
|
||||||
async function streamNodeData(flow: FlowType) {
|
async function streamNodeData(flow: FlowType) {
|
||||||
// Step 1: Make a POST request to send the flow data and receive a unique session ID
|
// Step 1: Make a POST request to send the flow data and receive a unique session ID
|
||||||
const response = await postBuildInit(flow);
|
const id = saveFlow({ ...flow, data: reactFlowInstance!.toObject() }, true);
|
||||||
|
const response = await postBuildInit({
|
||||||
|
...flow,
|
||||||
|
data: reactFlowInstance!.toObject(),
|
||||||
|
});
|
||||||
const { flowId } = response.data;
|
const { flowId } = response.data;
|
||||||
// Step 2: Use the session ID to establish an SSE connection using EventSource
|
// Step 2: Use the session ID to establish an SSE connection using EventSource
|
||||||
let validationResults: boolean[] = [];
|
let validationResults: boolean[] = [];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue