fixed breakage

This commit is contained in:
ari committed 2022-07-14 16:01:54 -04:00
1 parent 8bf25547eb
commit 58f18232b7
3 files changed
+9 -17

No files matched your search

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