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

Fix validateable items not showing error text in some cases #5324

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

coder-in-go
Copy link

@coder-in-go coder-in-go commented Dec 17, 2024

Description:

This PR fixes the issue where error text is not displayed for Validateable items unless they are widget.Entry or have HintText set.

Fixes #5194

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

…less they are widget.Entry or have HintText set
@Jacalz Jacalz changed the title Fix for issue: 5194 Validateable items don't show their error text unless they are widget.Entry or have HintText set Fix validateable items not showing error text in some cases Dec 17, 2024
Copy link
Member

@andydotxyz andydotxyz left a comment

Choose a reason for hiding this comment

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

Thanks for this, I have one comment inline about if some code is needed (the comment indicates it isn't or you're not sure).

Secondly please don't add comments unless absolutely necessary. Code should be (and mostly is) clear enough itself - comments take up space and break over time.

@@ -344,23 +338,26 @@ func (f *Form) setValidationError(err error) {
}

func (f *Form) updateHelperText(item *FormItem) {
if item.helperOutput == nil {
return // Exit early if helperOutput is not initialized (shouldn't happen with the updated createInput)
Copy link
Member

Choose a reason for hiding this comment

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

If this should not happen then is the line needed?

}
f.updateHelperText(item) // Ensure the helper text is updated
Copy link
Member

Choose a reason for hiding this comment

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

When methods are named clearly comments often add nothing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants