Skip to content

Conversation

hakenr
Copy link
Member

@hakenr hakenr commented Apr 16, 2025

Fixes #1062.

@hakenr hakenr requested review from Copilot and jirikanda April 16, 2025 15:07
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 #1062 by introducing a ChipRemoveActionBuilder to dynamically build chip removal actions from expression trees and updating the HxInputBase component accordingly. Key changes include:

  • Introducing ChipRemoveActionBuilder for deferred expression parsing and caching.
  • Updating HxInputBase to use the new builder for chip removal.
  • Adding comprehensive tests to ensure correct behavior and error handling.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
HxInputBaseTests/HxInputBase_GetChipRemoveAction_NestedModel_Test.razor Added test page to exercise chip removal on nested models.
Forms/Internal/ChipRemoveActionBuilder.cs New builder class for creating chip removal actions from expressions.
Forms/HxInputBase.cs Updated to utilize the new ChipRemoveActionBuilder.
Forms/Internal/ChipRemoveActionBuilderTests.cs Added tests covering various scenarios for the builder.
Files not reviewed (1)
  • Havit.Blazor.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml: Language not supported
Comments suppressed due to low confidence (1)

Havit.Blazor.Components.Web.Bootstrap/Forms/HxInputBase.cs:406

  • [nitpick] Consider renaming 'builder' to a more descriptive name such as 'chipRemoveActionBuilder' for improved code clarity.
var builder = new ChipRemoveActionBuilder(ValueExpression, value);

@hakenr
Copy link
Member Author

hakenr commented Apr 16, 2025

@jirikanda I'm going to merge this into master since I need to publish a pre-release.
Would appreciate it if you could give the changes a second look.

@hakenr hakenr requested a review from Copilot April 16, 2025 15:32
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 #1062 by refactoring the chip removal action to use a dedicated builder, and adds both integration and unit tests to validate the new behavior.

  • Introduces ChipRemoveActionBuilder for generating chip removal actions.
  • Updates HxInputBase to use the new builder.
  • Adds integration tests in a new Razor test file and comprehensive unit tests for the builder.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

File Description
HxInputBaseTests/HxInputBase_GetChipRemoveAction_NestedModel_Test.razor Added a new interactive test page for nested model chip removal.
Forms/Internal/ChipRemoveActionBuilder.cs Introduces a builder that constructs the chip removal action at runtime.
Forms/HxInputBase.cs Refactored GetChipRemoveAction to use the new builder instead of an inline lambda.
Forms/Internal/ChipRemoveActionBuilderTests.cs Added unit tests covering various scenarios for the ChipRemoveActionBuilder.
Files not reviewed (1)
  • Havit.Blazor.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml: Language not supported
Comments suppressed due to low confidence (1)

Havit.Blazor.Components.Web.Bootstrap/Forms/Internal/ChipRemoveActionBuilder.cs:36

  • The List is declared without importing System.Collections.Generic, which may lead to compile errors. Please add 'using System.Collections.Generic;' at the top of the file.
var accessChain = new List<MemberInfo>();

@hakenr hakenr merged commit 7bb1826 into master Apr 16, 2025
1 check passed
@hakenr hakenr deleted the feature/ChipRemoveActionBuilder branch April 16, 2025 15:34
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.

[HxInputBase] [HxFilterForm] [HxChipList] - GetChipRemoveAction does not support nested (composite) models
1 participant