-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: Workflow Basic Node User Input Configurable Title #4439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -209,7 +209,10 @@ onMounted(() => { | |
| if (props.nodeModel.properties.user_input_field_list) { | ||
| inputFieldList.value = cloneDeep(props.nodeModel.properties.user_input_field_list) | ||
| } | ||
|
|
||
| if (props.nodeModel.properties.user_input_config) { | ||
| inputFieldConfig.value = props.nodeModel.properties.user_input_config | ||
| } | ||
| set(props.nodeModel.properties, 'user_input_config', inputFieldConfig) | ||
| onDragHandle() | ||
| }) | ||
| </script> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The provided code makes several improvements compared to the original:
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. |
||
|
|
||
There was a problem hiding this comment.
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:
Props Propagation: Ensure that
workflowprop is correctly passed and not null before accessing its children nodes.Computed Properties:
chat_titlecomputed property uses a template string ($t) to translate strings directly fromprops.workflow. This can be problematic if there's no translation module provided.Null/Undefined Checks: Always add checks for
nullvalues when dealing with objects or arrays returned by APIs or component properties.Data Binding Errors:
<template #default>, ensure$treturns the correct translated value, even if it might not exist due to previous steps.Component Naming Convention: Class names and function names should be kebab-case for consistency across projects.
Performance Considerations: If
dynamicsFormRef.value?.validate()might execute frequently, consider debouncing this method call to avoid unnecessary re-renders.Accessibility:
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:
Implement these improvements to make your application more robust and efficient.