Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: clean invisible edge when toggling tool mode #4795

Merged
merged 3 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ body {
transition-duration: 150ms;
stroke-width: 2px !important;
}
.react-flow__connection path {
transition: color;
stroke: var(--connection) !important;
transition-duration: 150ms;
stroke-width: 2px !important;
}

.react-flow__edge.running .react-flow__edge-path {
stroke: hsl(var(--foreground)) !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import { useTypesStore } from "../../../../stores/typesStore";
import { APIClassType } from "../../../../types/api";
import { NodeType } from "../../../../types/flow";
import {
checkOldComponents,
generateFlow,
generateNodeFromFlow,
getNodeId,
Expand Down Expand Up @@ -535,7 +534,6 @@ export default function Page({ view }: { view?: boolean }): JSX.Element {
onSelectionEnd={onSelectionEnd}
onSelectionStart={onSelectionStart}
connectionRadius={30}
elevateEdgesOnSelect={true}
edgeTypes={edgeTypes}
connectionLineComponent={ConnectionLineComponent}
onDragOver={onDragOver}
Expand Down
4 changes: 3 additions & 1 deletion src/frontend/src/stores/flowStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { FlowStoreType, VertexLayerElementType } from "../types/zustand/flow";
import { buildFlowVerticesWithFallback } from "../utils/buildUtils";
import {
checkChatInput,
checkOldComponents,
cleanEdges,
detectBrokenEdgesEdges,
getHandleId,
Expand Down Expand Up @@ -278,6 +277,8 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
return node;
});

const newEdges = cleanEdges(newNodes, get().edges);

if (callback) {
// Defer the callback execution to ensure it runs after state updates are fully applied.
queueMicrotask(callback);
Expand All @@ -286,6 +287,7 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
return {
...state,
nodes: newNodes,
edges: newEdges,
};
});
},
Expand Down