Skip to content

Commit 83c9531

Browse files
author
zhangliang13-jk
committed
fix: ensure running edges re-render by using immutable edge updates
1 parent 403b939 commit 83c9531

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/frontend/src/stores/flowStore.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -933,21 +933,21 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
933933
},
934934
updateEdgesRunningByNodes: (ids: string[], running: boolean) => {
935935
const edges = get().edges;
936+
const stopNodeId = get().stopNodeId;
936937

937938
const newEdges = edges.map((edge) => {
938-
if (
939+
const shouldRun =
939940
edge.data?.sourceHandle &&
940941
ids.includes(edge.data.sourceHandle.id ?? "") &&
941-
edge.data.sourceHandle.id !== get().stopNodeId
942-
) {
943-
edge.animated = running;
944-
edge.className = running ? "running" : "";
945-
} else {
946-
edge.animated = false;
947-
edge.className = "not-running";
948-
}
949-
return edge;
942+
edge.data.sourceHandle.id !== stopNodeId;
943+
944+
return {
945+
...edge,
946+
animated: shouldRun ? running : false,
947+
className: shouldRun && running ? "running" : "not-running",
948+
};
950949
});
950+
951951
set({ edges: newEdges });
952952
},
953953
clearEdgesRunningByNodes: async (): Promise<void> => {

0 commit comments

Comments
 (0)