Summary
EditContext's flat model design means nested field identifiers (e.g., Items[0].ProductName) are currently handled at the component level rather than through Blazor's built-in FieldIdentifier system. The current approach works but could be improved for better integration with Blazor's validation infrastructure.
Context
Introduced in #20 (one-to-many collection field support). The CollectionFieldComponent manages its own validation state per item rather than leveraging EditContext.NotifyFieldChanged with proper nested field identifiers. This means:
- Validation messages are rendered by the component itself, not by Blazor's
ValidationMessage<T>
EditContext.IsModified() doesn't reflect changes in collection item fields
- Third-party validation summary components won't pick up nested field errors
Suggested Approach
- Implement a custom
FieldIdentifier strategy that encodes collection index and property path (e.g., Items[0].ProductName)
- Propagate field change notifications to the parent
EditContext
- Enable
ValidationMessage and ValidationSummary to display nested errors natively
Acceptance Criteria
Summary
EditContext's flat model design means nested field identifiers (e.g.,
Items[0].ProductName) are currently handled at the component level rather than through Blazor's built-inFieldIdentifiersystem. The current approach works but could be improved for better integration with Blazor's validation infrastructure.Context
Introduced in #20 (one-to-many collection field support). The
CollectionFieldComponentmanages its own validation state per item rather than leveragingEditContext.NotifyFieldChangedwith proper nested field identifiers. This means:ValidationMessage<T>EditContext.IsModified()doesn't reflect changes in collection item fieldsSuggested Approach
FieldIdentifierstrategy that encodes collection index and property path (e.g.,Items[0].ProductName)EditContextValidationMessageandValidationSummaryto display nested errors nativelyAcceptance Criteria
EditContextEditContext.IsModified("Items[0].ProductName")returns correct stateValidationSummarydisplays nested field errors