79329147

Date: 2025-01-04 16:10:04
Score: 0.5
Natty:
Report link

Your code you added in OnInitializedAsync()

Input.FirstName = user.FirstName;
Input.LastName = user.LastName;

Should include null-coalescing operator like so:

Input.FirstName ??= user.FirstName;
Input.LastName ??= user.LastName;

Each time the page is loaded the OnInitializeAsync method is run even when a user hits Save so your old user values are loaded into the InputModel and what ever was changed in you form is lost unless you use the ??= which only replaces the InputModel's value if it is null.

Read more here null-coalescing operators

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: S. Mines