-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: 1051456 #2028
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
fix: 1051456 #2028
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 |
|---|---|---|
|
|
@@ -169,6 +169,7 @@ const applicationNodeFormRef = ref<FormInstance>() | |
| const form_data = computed({ | ||
| get: () => { | ||
| if (props.nodeModel.properties.node_data) { | ||
| console.log(props.nodeModel.properties.node_data) | ||
| return props.nodeModel.properties.node_data | ||
| } else { | ||
| set(props.nodeModel.properties, 'node_data', form) | ||
|
|
@@ -222,7 +223,6 @@ const update_field = () => { | |
| return item | ||
| } | ||
| }) | ||
| console.log(merge_api_input_field_list) | ||
| set( | ||
| props.nodeModel.properties.node_data, | ||
| 'api_input_field_list', | ||
|
|
@@ -248,9 +248,9 @@ const update_field = () => { | |
| 'user_input_field_list', | ||
| merge_user_input_field_list | ||
| ) | ||
| const fileEnable = nodeData.file_upload_enable | ||
| const fileUploadSetting = nodeData.file_upload_setting | ||
| // 如果是true,说明有文件上传 | ||
| if (fileUploadSetting) { | ||
| if (fileEnable) { | ||
| handleFileUpload('document', fileUploadSetting.document) | ||
| handleFileUpload('image', fileUploadSetting.image) | ||
| handleFileUpload('audio', fileUploadSetting.audio) | ||
|
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 code appears to be well-written and follows conventional ReactJS practices. While it doesn't contain serious errors, there is one minor issue with the indentation of a few lines at the bottom ( Additionally, you could add type annotations for interface FileUploadSettings {
document: FormData[];
image: FormData[];
// ... other fields ...
}
// ...
type NodeModel = {
properties : { node_data?: Object }
}However, this level of complexity may not be necessary unless you plan to use TypeScript extensively within your project. For general tips on improving readability and performance:
|
||
|
|
||
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.
The provided code is a TypeScript module that includes functions for handling logic flow nodes and translations, including localization using
i18nextthrought. Here are some points to review:Common Issues
Imports: Ensure all used modules are correctly imported at the beginning of the file. The imports look mostly correct.
Variable Initialization: It's good to initialize variables immediately after declaration to avoid undefined errors.
Type Annotations: While type annotations are present, ensure they align with actual data types used in the function.
Comments: Comments should be clear and helpful, especially for unfamiliar readers or future developers.
Optimization Suggestions
Function Naming: Consider more descriptive names for functions like
processNodeDatainstead oftranslationNodeData.Null Check: Add checks to handle cases where
nodeDatamight be null before accessing its properties, which would prevent runtime errors.Proposed Changes
Here’s an improved version of the code with these considerations:
Key Points Addressed:
selectedtonull.processNodeDatafor clarity.t()for localizing strings, ensuring proper internationalization support.