Skip to content

fix: enhanced SSR update ignored in FluentNumberField #3906

@davhdavh

Description

@davhdavh

🐛 Bug Report

See sample below...

  1. click 'Load Existing'
  2. If staticform-reset has data-enhance then html will correctly update to <fluent-number-field class="valid" maxlength="14" minlength="1" size="20" step="1" id="f688f055" value="42" name="Model.Age" appearance="outline">, but the actual input inside will not get updated
  3. if no data-enhance, the problem goes away.
  4. if using any @rendermode problem goes away. It only happens in SSR.

💻 Repro or Code Sample

@page "/staticform"
<EditForm Model="@Model" OnValidSubmit="@HandleValidSubmit" FormName="staticform">
 <DataAnnotationsValidator />
 <FluentNumberField Name="@FieldName(Model.Age)" @bind-Value="Model.Age" Label="Age"  />
</EditForm>

<form method="post" data-enhance @onsubmit="@Load" @formname="staticform-reset">
 <AntiforgeryToken/>
 <FluentButton Type="ButtonType.Submit" Appearance="Appearance.Stealth">Load Existing</FluentButton>
</form>
@code {
 private static string FieldName(object propertyName, [CallerArgumentExpression(nameof(propertyName))] string? memberName = null) => memberName!;

 [SupplyParameterFromForm] private FormModel? Model { get; set; }

 private bool formSubmitted = false;

 protected override void OnInitialized() => Model ??= new();

 private void HandleValidSubmit()
 {
  formSubmitted = true;
 }

 private void Load()
 {
  Model = new(){Age = 42};
  formSubmitted = false;
 }

 public class FormModel
 {

  [Range(18, 120)] public int Age { get; set; } = 18;

 }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions