Skip to content

Commit aff624d

Browse files
committed
Remove scheduler usage from CanExecuteChanged handling
Eliminated the use of ObserveOn and explicit scheduling on the main thread when raising CanExecuteChanged events. This simplifies event invocation and avoids unnecessary scheduler dependencies.
1 parent 01d47c9 commit aff624d

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

src/ReactiveUI/ReactiveCommand/ReactiveCommand.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,6 @@ protected internal ReactiveCommand(
847847
.Select(x => x.Result);
848848

849849
_canExecuteSubscription = _canExecute
850-
.ObserveOn(_outputScheduler)
851850
.Subscribe(OnCanExecuteChanged);
852851
}
853852

src/ReactiveUI/ReactiveCommand/ReactiveCommandBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public void Dispose()
140140
protected void OnCanExecuteChanged(bool newValue)
141141
{
142142
_canExecuteValue = newValue;
143-
RxSchedulers.MainThreadScheduler.Schedule(() => _canExecuteChanged?.Invoke(this, EventArgs.Empty));
143+
_canExecuteChanged?.Invoke(this, EventArgs.Empty);
144144
}
145145

146146
/// <summary>

0 commit comments

Comments
 (0)