fix(tabsContext.tsx): add checkOldEdgesHandles function to ensure that only old edges with invalid handles are updated
fix(reactflowUtils.ts): rename checkEdgesHandles function to checkOldEdgesHandles for clarity
This commit is contained in:
parent
d6168cabde
commit
b656efba7d
2 changed files with 6 additions and 3 deletions
|
|
@ -27,6 +27,7 @@ import {
|
|||
import { TabsContextType, TabsState } from "../types/tabs";
|
||||
import {
|
||||
addVersionToDuplicates,
|
||||
checkOldEdgesHandles,
|
||||
scapeJSONParse,
|
||||
scapedJSONStringfy,
|
||||
updateEdgesHandleIds,
|
||||
|
|
@ -154,8 +155,10 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
|||
|
||||
function processFlowEdges(flow: FlowType) {
|
||||
if (!flow.data || !flow.data.edges) return;
|
||||
const newEdges = updateEdgesHandleIds(flow.data);
|
||||
flow.data.edges = newEdges;
|
||||
if (checkOldEdgesHandles(flow.data.edges)) {
|
||||
const newEdges = updateEdgesHandleIds(flow.data);
|
||||
flow.data.edges = newEdges;
|
||||
}
|
||||
flow.data.edges.forEach((edge) => {
|
||||
edge.className = "";
|
||||
edge.style = { stroke: "#555" };
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ export function scapeJSONParse(json: string): any {
|
|||
}
|
||||
|
||||
// this function receives an array of edges and return true if any of the handles are not a json string
|
||||
export function checkEdgesHandles(edges: Edge[]): boolean {
|
||||
export function checkOldEdgesHandles(edges: Edge[]): boolean {
|
||||
return edges.some(
|
||||
(edge) =>
|
||||
!edge.sourceHandle ||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue