fixed breakage
This commit is contained in:
1 parent
8bf25547eb
commit
58f18232b7
3 files changed
+9
-17
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import "./index.css";
|
||||
|
||||
import { FC } from "react";
|
||||
import { FC, useRef } from "react";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import ReactFlow, {
|
||||
Controls,
|
||||
@@ -28,6 +28,7 @@ export const DAGGraphBoardInner: FC<DAGGraphBoardProps> = ({
|
||||
closeModal,
|
||||
}) => {
|
||||
const { zoom } = useViewport();
|
||||
const lastZoom = useRef(zoom);
|
||||
// render unready or errored states
|
||||
if (!state.ready) {
|
||||
return (
|
||||
@@ -58,18 +59,10 @@ export const DAGGraphBoardInner: FC<DAGGraphBoardProps> = ({
|
||||
);
|
||||
}
|
||||
// this hack avoids breakage on when zooming
|
||||
const prefix = zoom;
|
||||
// const prefix = Date.now();
|
||||
const elements = {
|
||||
nodes: state.data.elements.nodes.map((n) => ({
|
||||
...n,
|
||||
id: `${prefix}-${n.id}`,
|
||||
})),
|
||||
edges: state.data.elements.edges.map((n) => ({
|
||||
...n,
|
||||
id: `${prefix}-${n.id}`,
|
||||
source: `${prefix}-${n.source}`,
|
||||
target: `${prefix}-${n.target}`,
|
||||
})),
|
||||
nodes: state.data.elements.nodes,
|
||||
edges: state.data.elements.edges,
|
||||
};
|
||||
// main render
|
||||
return (
|
||||
@@ -78,13 +71,13 @@ export const DAGGraphBoardInner: FC<DAGGraphBoardProps> = ({
|
||||
<ReactFlow
|
||||
className="dag-graphboard"
|
||||
nodeTypes={nodeTypes}
|
||||
snapToGrid
|
||||
onlyRenderVisibleElements
|
||||
fitView
|
||||
minZoom={0.25}
|
||||
nodesConnectable={false}
|
||||
nodesDraggable={false}
|
||||
{...elements}
|
||||
>
|
||||
<Controls />
|
||||
<Controls showInteractive={false} />
|
||||
</ReactFlow>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -21,8 +21,6 @@ import { AddIcon } from "components/Icons";
|
||||
import { useDAGElementsState } from "./state";
|
||||
import AddBox from "@mui/icons-material/AddBox";
|
||||
import { DAGGraphChooseUpdater, DAGGraphUpdater } from "../updater";
|
||||
import { ReactNode } from "react";
|
||||
import DeleteForever from "@mui/icons-material/DeleteForever";
|
||||
|
||||
export const useAutomationNodes = (
|
||||
automation: AutomationActionData,
|
||||
|
||||
@@ -10,6 +10,7 @@ export const AutomationActionNodeBase = st.type({
|
||||
alias: st.optional(st.string()),
|
||||
variables: st.optional(st.record(st.string(), st.any())),
|
||||
enabled: st.optional(st.boolean()),
|
||||
continue_on_error: st.optional(st.boolean()),
|
||||
});
|
||||
|
||||
export const ServiceAction = st.intersection([
|
||||
|
||||
Reference in new issue
Block a user