-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
✔️ Resolution: DuplicateResolved as a duplicate of another issueResolved as a duplicate of another issueStatus: Resolvedarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Components
Description
Describe the bug
When I set an OnInput action that modifies the incoming input, the change I have made is not reflected in the UI.
To Reproduce
<label>MyString: </label>
<input type="text" @oninput="inputFilter" value="@myString" />
@code {
private string myString { get; set; }
private void inputFilter(ChangeEventArgs args)
{
if(args.Value != null)
{
var value = args.Value.ToString();
myString = value.Replace("a", "");
}
}
}
Now run the application, type into the textbox some text, then type an 'a' character. If reproduced, the 'a' does not get replaced until you type another VALID character. Odd behavior. No exceptions are thrown. Try typing several a's in a row; then type another character.
Note: I have seen this related issue/work around (#17702 (comment)), not 100% certain that it applies here but it does work around my problem at the moment.
Further technical details
- .NET Core 3.1
- Running in Visual Studio Professional 16.4.5
- Output of
dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.101
Commit: b377529961
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.101\
Host (useful for support):
Version: 3.1.1
Commit: a1388f194c
.NET Core SDKs installed:
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.509 [C:\Program Files\dotnet\sdk]
2.1.511 [C:\Program Files\dotnet\sdk]
3.1.101 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Metadata
Metadata
Assignees
Labels
✔️ Resolution: DuplicateResolved as a duplicate of another issueResolved as a duplicate of another issueStatus: Resolvedarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Components