You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to trigger an async method from a Switch component, but whenever I insert the delay then the event loops forever. The method executes once as expected if I remove the delay, but the UI doesn't update in this case so the old tabs element isn't removed like I am trying to accomplish.
<Switch class="float-end" @bind-Value=hideInactive @bind-Value:after="HandleHideInactive" Label="Hide Inactive Projects" />
@code
{
private bool hideInactive;
private async Task HandleHideInactive()
{
//Need to recreate the DOM to remove the old tabs element and replace with new one
FilteredProjects = null;
await Task.Delay(500);
FilteredProjects = Projects.Where(n => n.Status == hideInactive).ToList();
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am trying to trigger an async method from a Switch component, but whenever I insert the delay then the event loops forever. The method executes once as expected if I remove the delay, but the UI doesn't update in this case so the old tabs element isn't removed like I am trying to accomplish.
Beta Was this translation helpful? Give feedback.
All reactions