feat: made (reduced) program data available on all pages

This commit is contained in:
Gerla, J. (Justin)
2026-01-06 12:27:22 +00:00
committed by JobvAlewijk
parent faaf67138d
commit bd93b04bfd
4 changed files with 207 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ import {
import '@xyflow/react/dist/style.css';
import {useEffect} from "react";
import {useShallow} from 'zustand/react/shallow';
import useProgramStore from "../../utils/programStore.ts";
import {DndToolbar} from './visualProgrammingUI/components/DragDropSidebar.tsx';
import useFlowStore from './visualProgrammingUI/VisProgStores.tsx';
import type {FlowState} from './visualProgrammingUI/VisProgTypes.tsx';
@@ -152,6 +153,10 @@ function runProgram() {
).then((res) => {
if (!res.ok) throw new Error("Failed communicating with the backend.")
console.log("Successfully sent the program to the backend.");
// store reduced program in global program store for further use in the UI
// when the program was sent to the backend successfully:
useProgramStore.getState().setProgramState(structuredClone(program));
}).catch(() => console.log("Failed to send program to the backend."));
}