Skip to content

Conversation

@shaohuzhang1
Copy link
Contributor

fix: Workflow Basic Node User Input Configurable Title

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Dec 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.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Dec 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

})
const base_form_list = computed(() => {
const kBase = props.workflow?.nodes?.find((n: any) => n.type === WorkflowType.KnowledgeBase)
if (kBase) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is a checklist of common issues with front-end React components:

  1. Props Propagation: Ensure that workflow prop is correctly passed and not null before accessing its children nodes.

  2. Computed Properties:

    • The chat_title computed property uses a template string ($t) to translate strings directly from props.workflow. This can be problematic if there's no translation module provided.
    • It would be better to use Vuex store or similar state management solutions to centralize translations for easier maintenance.
  3. Null/Undefined Checks: Always add checks for null values when dealing with objects or arrays returned by APIs or component properties.

  4. Data Binding Errors:

    • In <template #default>, ensure $t returns the correct translated value, even if it might not exist due to previous steps.
    • Use optional chaining or default parameters where needed to prevent errors when data might not be available initially.
  5. Component Naming Convention: Class names and function names should be kebab-case for consistency across projects.

  6. Performance Considerations: If dynamicsFormRef.value?.validate() might execute frequently, consider debouncing this method call to avoid unnecessary re-renders.

  7. Accessibility:

    • Add ARIA attributes where necessary for screen readers to accurately interpret components like dropdown menus.
    • Ensure proper focus handling during user interactions.
  8. Dynamic Content Injection: Be cautious about dynamic content in templates, especially regarding XSS attacks, by sanitizing data as appropriate.

To optimize your code further without altering its functionality significantly:

  • Extract complex logic into reusable functions.
  • Move stateful variables outside the render cycle using refs to avoid unnecessary updates.
  • Use functional hooks rather than classes where applicable to improve performance and type safety.

Implement these improvements to make your application more robust and efficient.

set(props.nodeModel.properties, 'user_input_config', inputFieldConfig)
onDragHandle()
})
</script>
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 makes several improvements compared to the original:

  1. Initialization of inputFieldConfig: A variable named inputFieldConfig is initialized using props.nodeModel.properties.user_input_config. This ensures that it's properly scoped and accessible within the closure.

  2. Assignment back to nodeModel: The line set(props.node_model, 'user_input_config', input_field_config) assigns the value of inputFieldConfig back to nodeModel, which updates the prop accordingly.

  3. Simplified Condition Check: The condition check for user_input_field_list remains the same, cloning the list into inputFieldList.

  4. Comments Added: Comments are added before each block of code where new logic is introduced for clarity.

Overall, the changes enhance readability and maintainability by organizing related logic together and initializing variables appropriately. These optimizations prevent potential issues such as undefined properties and ensure that the state is correctly managed.

@shaohuzhang1 shaohuzhang1 merged commit 8fd568d into v2 Dec 4, 2025
4 of 6 checks passed
@shaohuzhang1 shaohuzhang1 deleted the pr@v2@fix_workflow_knowledge_base branch December 4, 2025 10:58
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