Skip to content

Commit 6d26698

Browse files
committed
Default to ValueProperty of Key
The previous code assumed that `ValueProperty` is always set for `TopicListAttribute`s. That shouldn't be assumed. If the `ValueProperty` isn't set, for some reason, we should fall back to a reasonable default. `Key` makes sense in most scenarios.
1 parent 3906c4a commit 6d26698

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

OnTopic.Editor.AspNetCore/Components/TopicListViewComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public IViewComponentResult Invoke(
5858
attribute.RootTopicKey ??= attribute.GetConfigurationValue( "Scope", null);
5959
attribute.AttributeKey ??= attribute.GetConfigurationValue( "AttributeName", null);
6060
attribute.AttributeValue ??= attribute.GetConfigurationValue( "AttributeValue", null);
61-
attribute.ValueProperty ??= attribute.GetConfigurationValue( "ValueProperty", null);
61+
attribute.ValueProperty ??= attribute.GetConfigurationValue( "ValueProperty", "Key");
6262
var allowedKeys = attribute.GetConfigurationValue( "AllowedKeys", null);
6363

6464
/*------------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)