-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Fixes in PrefixResolver #63334
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
Fixes in PrefixResolver #63334
Conversation
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.
Pull Request Overview
This pull request fixes issues in the PrefixResolver
component to improve form binding logic, particularly for recursive model binding scenarios. The changes enhance segment comparison accuracy in the FormKeyComparer
and add comprehensive test coverage to verify the fixes work correctly.
- Refactored the
FormKeyComparer
logic to handle edge cases where keys have different numbers of segments - Added comprehensive unit tests to verify prefix detection works for both positive and negative scenarios
- Created an E2E test with a supporting Razor page to validate recursive form binding functionality
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
PrefixResolver.cs |
Simplified and fixed the FormKeyComparer logic to properly handle segment comparison when keys have different segment counts |
PrefixResolverTests.cs |
Added new unit tests to verify prefix detection behavior with matching and non-matching entries |
FormWithParentBindingContextTest.cs |
Added E2E test to verify recursive form binding works end-to-end |
RecursiveEditFormBinding.razor |
New test page supporting the E2E test with a recursive model structure |
9eeb34e
to
4aa4eb3
Compare
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.
Looks good
Fixes in PrefixResolver
Description
This pull request improves the form binding logic and its test coverage, particularly around recursive model binding scenarios and prefix resolution. The main changes include enhancements to the
FormKeyComparer
for more reliable segment comparison, new and expanded unit tests for prefix handling, and the addition of a new E2E test and supporting Razor page for recursive form binding.Changes:
FormKeyComparer
logic inPrefixResolver.cs
to improve segment comparison accuracy, especially when handling cases where one key has more segments than the other. This makes prefix resolution more robust and correct.PrefixResolverTests.cs
to verify correct behavior of prefix detection with and without matching entries, ensuring the resolver works for both positive and negative scenarios.FormWithParentBindingContextTest.cs
that verifies recursive form binding works as expected, including input and form submission behavior.Fixes #61341