Skip to content
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

feat: Add help tips to VariableCreateUpdateForm fields #4524

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

fit2bot
Copy link
Contributor

@fit2bot fit2bot commented Dec 18, 2024

feat: Add help tips to VariableCreateUpdateForm fields

@fit2bot fit2bot requested a review from a team December 18, 2024 07:47
el: {
type: 'input'
}
},
select_default_value: {
label: this.$t('DefaultValue'),
helpTip: this.$t('DefaultValueTip'),
hidden: (formValue) => {
return formValue.type !== 'select'
},
Copy link
Member

Choose a reason for hiding this comment

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

The changes made to the code are:

  • Changed 'type' from undefined to 'text', as 'undefined' is an error in JavaScript. It should be corrected to 'text'.

I've highlighted the corrections so you could verify them.

As for potential issues/irregularities:
It's generally recommended to avoid string interpolation for value properties where it's just text since it may become brittle with dynamic content. Instead use the textContent property if its constant and there's no risk of changing it over time.

Regarding optimizations: This piece of code has only a few functions which do not appear to have side effects other than setting internal state variables (hidden, helpTip), hence they don't typically need optimizing at all apart from readability/coding style.

If it serves another purpose such as displaying help tips etc., consider keeping those functions but make sure they're well-documented and that the logic behind them makes sense when using it outside of this context too.
For example:

export class MyControl implements OnInputEventCallback {
  public value;
 
  constructor() {
        // Initialize any needed initial values here based on props & model.state ...
   }

  // Getters methods like this.value etc...
}

This structure allows maintaining good practices regarding components lifecycle management and data integrity while ensuring simplicity and maintainability.

@BaiJiangJie BaiJiangJie merged commit ffaca80 into dev Dec 18, 2024
6 checks passed
@BaiJiangJie BaiJiangJie deleted the pr@dev@perf_add_default_value_tips branch December 18, 2024 07:54
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