File tree 1 file changed +8
-1
lines changed
src/Components/Web/src/Forms 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ public abstract class InputBase<TValue> : ComponentBase, IDisposable
24
24
private bool _previousParsingAttemptFailed ;
25
25
private ValidationMessageStore ? _parsingValidationMessages ;
26
26
private Type ? _nullableUnderlyingType ;
27
+ private bool _shouldGenerateFieldNames ;
27
28
28
29
[ CascadingParameter ] private EditContext ? CascadedEditContext { get ; set ; }
29
30
@@ -204,7 +205,7 @@ protected string NameAttributeValue
204
205
return Convert . ToString ( nameAttributeValue , CultureInfo . InvariantCulture ) ?? string . Empty ;
205
206
}
206
207
207
- if ( EditContext ? . ShouldUseFieldIdentifiers ?? false )
208
+ if ( _shouldGenerateFieldNames )
208
209
{
209
210
if ( _formattedValueExpression is null && ValueExpression is not null )
210
211
{
@@ -241,6 +242,12 @@ public override Task SetParametersAsync(ParameterView parameters)
241
242
{
242
243
EditContext = CascadedEditContext ;
243
244
EditContext . OnValidationStateChanged += _validationStateChangedHandler ;
245
+ _shouldGenerateFieldNames = EditContext . ShouldUseFieldIdentifiers ;
246
+ }
247
+ else
248
+ {
249
+ // Ideally we'd know if we were in an SSR context but we don't
250
+ _shouldGenerateFieldNames = ! OperatingSystem . IsBrowser ( ) ;
244
251
}
245
252
246
253
_nullableUnderlyingType = Nullable . GetUnderlyingType ( typeof ( TValue ) ) ;
You can’t perform that action at this time.
0 commit comments