Skip to content

Commit 0b6c36e

Browse files
authored
feat(ValidateForm): use IOptionsMonitor option (#6555)
1 parent 096d3a7 commit 0b6c36e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/BootstrapBlazor/Components/InputNumber/BootstrapInputNumber.razor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public partial class BootstrapInputNumber<TValue>
9393

9494
[Inject]
9595
[NotNull]
96-
private IOptions<BootstrapBlazorOptions>? StepOption { get; set; }
96+
private IOptionsMonitor<BootstrapBlazorOptions>? StepOption { get; set; }
9797

9898
private string? _lastInputValueString;
9999

@@ -123,7 +123,7 @@ protected override void OnParametersSet()
123123
MinusIcon ??= IconTheme.GetIconByKey(ComponentIcons.InputNumberMinusIcon);
124124
PlusIcon ??= IconTheme.GetIconByKey(ComponentIcons.InputNumberPlusIcon);
125125

126-
StepString = Step ?? StepOption.Value.GetStep<TValue>() ?? "any";
126+
StepString = Step ?? StepOption.CurrentValue.GetStep<TValue>() ?? "any";
127127

128128
if (Value is null)
129129
{

src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public partial class ValidateForm
9696

9797
[Inject]
9898
[NotNull]
99-
private IOptions<JsonLocalizationOptions>? Options { get; set; }
99+
private IOptionsMonitor<JsonLocalizationOptions>? Options { get; set; }
100100

101101
[Inject]
102102
[NotNull]
@@ -388,7 +388,7 @@ private void ValidateDataAnnotations(object? value, ValidationContext context, L
388388
var find = false;
389389
if (!string.IsNullOrEmpty(rule.ErrorMessage))
390390
{
391-
var resourceType = Options.Value.ResourceManagerStringLocalizerType;
391+
var resourceType = Options.CurrentValue.ResourceManagerStringLocalizerType;
392392
if (resourceType != null && LocalizerFactory.Create(resourceType).TryGetLocalizerString(rule.ErrorMessage, out var text))
393393
{
394394
rule.ErrorMessage = text;

0 commit comments

Comments
 (0)