Skip to content

Conversation

ericnewcomer
Copy link
Member

No description provided.

@Copilot Copilot AI review requested due to automatic review settings September 2, 2025 20:19
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the allowCreate functionality for the Select component, specifically addressing error handling when creating new options fails. The changes improve the user experience by properly restoring the previous state and displaying a meaningful error message when option creation fails.

Key changes:

  • Removed complex materialization logic that was duplicating option creation functionality
  • Added proper error handling with state restoration and user-friendly error messages
  • Simplified the option creation flow to handle failures more gracefully

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

File Description
src/form/select/Select.ts Removes duplicate option creation logic, simplifies flow, and adds error handling with state restoration
src/locales/*.ts Adds new error message for failed option creation in multiple languages
xliff/*.xlf Updates translation files with new error message entry

@@ -943,6 +880,7 @@ export class Select<T extends SelectOption> extends FieldElement {
}

public handleOptionSelection(event: CustomEvent) {
const previous = [...this.values];
Copy link
Preview

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

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

This change lacks test coverage. According to the coding guidelines, 100% code coverage is expected for all touched code. Tests should verify that the previous state is properly restored when option creation fails.

Copilot generated this review using guidance from repository custom instructions.

Comment on lines 903 to 904
this.values = previous;
this.errors = [msg('There was a problem creating your selection.')];
Copy link
Preview

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

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

This error handling logic lacks test coverage. According to the coding guidelines, 100% code coverage is expected for all touched code. Tests should verify that errors are properly set and the previous values are restored when the POST request fails.

Copilot generated this review using guidance from repository custom instructions.

Copy link

github-actions bot commented Sep 2, 2025

📊 Coverage Report

📊 Coverage Report
==================
Lines:      28865/35295 (81.78%)
Functions:  804/1139 (70.59%)
Branches:   1671/2452 (68.15%)
==================
✅ Statement Coverage: 81.78% (above 80% threshold)

🎉 Build passed: Statement coverage meets the 80% threshold!
Done in 124.51s.

Summary

  • Lines: 81.78%
  • Functions: 70.59%
  • Branches: 68.15%

Coverage Report

@ericnewcomer ericnewcomer merged commit 48637c8 into main Sep 4, 2025
5 checks passed
@ericnewcomer ericnewcomer deleted the fix-allow-create branch September 4, 2025 19:12
@github-actions github-actions bot locked and limited conversation to collaborators Sep 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant