Skip to content

Conversation

@shaohuzhang1
Copy link
Contributor

chore: update tool_params handling in index.vue --bug=1062339 --user=刘瑞斌 【MCP】MCP节点,从“引用变量” 切换到 “自定义” 没有清空 “引用变量” 的值 https://www.tapd.cn/62980211/s/1782327

--bug=1062339 --user=刘瑞斌 【MCP】MCP节点,从“引用变量” 切换到 “自定义” 没有清空 “引用变量” 的值 https://www.tapd.cn/62980211/s/1782327
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Oct 9, 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.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Oct 9, 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

@change="form_data.tool_params[item.label.label] = ''"
>
<el-option
:label="$t('views.applicationWorkflow.nodes.replyNode.replyContent.reference')"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

After reviewing the provided code snippet, I've identified a couple of potential issues:

Issue 1: Overwriting Form Data Immediately After Changes

In both cases where an @change event is triggered on the select component, you're immediately overwriting all parameters under form_data.tool_params[form_data.params_nested]. If this nested object contains multiple properties or values, it might lead to loss of previously set data.

Suggestion: Change the line

form_data.tool_params[form_data.params_nested] = {};

to

const currentParams = form_data.tool_params[form_data.params_nested];
// Ensure params exists before merging with new item label value
if (currentParams) {
    currentParams[item.label.label] = '';
} else {
    form_data.tool_params[form_data.params_nested] = { [item.label.label]: '' };
}

This prevents overwriting other keys in params_nested, ensuring that only necessary changes are made.

Optimizations

Avoiding Redundant Operations in Select Component

The first version of the change handler already clears the entire nested object (tool_params) when source changes. However, if another parameter within the same level needs to be preserved after changing one, you could add conditional logic within this approach to avoid resetting non-relevant keys.

Note: If there's a specific requirement that all child nodes of params_nested need to reset every time its parent source changes, then the above modification aligns with your intentions. Otherwise, consider whether additional conditional checks can help manage updates more precisely at different levels.

@liuruibin liuruibin merged commit 4d81b00 into release-2.2 Oct 9, 2025
5 of 8 checks passed
@liuruibin liuruibin deleted the [email protected]@chore_update_tool branch October 9, 2025 08:13
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.

3 participants