Skip to content

Conversation

@shaohuzhang1
Copy link
Contributor

fix: [Advanced Orchestration] The content in the specified reply was repeated several times when the Q&A was output. #3754

…repeated several times when the Q&A was output. #3754
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Aug 4, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

return !is_c && !isLoop(sourceNode.id, targetNode.id)
},
})

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provided code has a minor issue where it checks if there's a loop between nodes before determining if one node can be placed in another without causing recursion. This seems to unnecessarily double-check the non-loop condition.

Here is an improved version of the function:

validate: (
  sourceNode: any,
  targetNode: any,
  sourceAnchor: any,
  targetAnchor: any
) => {
  const up_nodes = this.graphModel.getNodeIncomingNodes(targetNode.id);
  const is_c_or_loop = up_nodes.some(up_node => up_node.id === sourceNode.id || isLoop(sourceNode.id, targetNode.id));
  return !is_c_or_loop;
}

By combining the two conditions into a single some call using logical OR (||), we avoid redundant checking. If either condition (up_node.id === sourceNode.id or isLoop) evaluates to true, the function returns false, meaning the placement is invalid due to recursion. Otherwise, it returns true.

@shaohuzhang1 shaohuzhang1 merged commit 6e1fb1d into v2 Aug 4, 2025
3 of 4 checks passed
@shaohuzhang1 shaohuzhang1 deleted the pr@v2@fix_workflow branch August 4, 2025 06:19
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Aug 4, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants