question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add method to indicate an event handler should enforce value consistency

See original GitHub issue

In other words, a way to tell Blazor that a given event handler is part of a two-way binding even if you’re not using @bind.

It would probably look like this:

<input value="@MyValue" @onchange="MyHandler" @onchange:enforceConsistency />

… or maybe @onchange:sync or @onchange:twoWay. The implementation is simply to emit a builder.SetUpdatesAttributeName call for whatever is the “value” attribute for this element type (e.g., on <input type=checkbox> it would call builder.SetUpdatesAttributeName("checked");).

For more details about the scenario and justification for this design, see https://github.com/aspnet/AspNetCore/issues/17099#issuecomment-556825048

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:10
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
JvanderStadcommented, May 14, 2021

Looking forward to this one!

2reactions
hultqvistcommented, Apr 28, 2020

I’m looking for a workaround. This one appears to work though there’s some magic in there.

async Task MyHandler(ChangeEventArgs args)
{
    var old = Text;
    Text = args.Value as string;
    await Task.Delay(1); //Magic!
    Text = old;
Read more comments on GitHub >

github_iconTop Results From Across the Web

EventTarget: addEventListener() method - Web APIs | MDN
An object that specifies characteristics about the event listener. The available options are: ... A boolean value indicating whether events of ...
Read more >
Commanded.Event.Handler — Commanded v1.4.2
Consistency. For each event handler you can define its consistency, as one of either :strong or :eventual . This setting is used when...
Read more >
Domain events: Design and implementation
Domain events to enforce consistency between multiple aggregates within the ... Handle domain events (within the current process) that will ...
Read more >
Event Handlers
1 Introduction Event handlers define microflows that handle certain events related to the entity. Depending on the chosen moment and type, ...
Read more >
Understanding events and event handlers in C# - ...
To understand event handlers, you need to understand delegates. In C#, you can think of a delegate as a pointer (or a reference)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found