Observe R3 events on threadpool v2

This commit is contained in:
Matt Parker
2025-12-05 22:16:57 +10:00
parent f5c24ce0af
commit b553fba3e7
3 changed files with 5 additions and 4 deletions

View File

@@ -17,7 +17,7 @@ public partial class ForwardBackwardButtonContainer : HBoxContainer
_forwardButton = GetNode<Button>("ForwardButton");
_backwardButton.Pressed += OnBackwardButtonPressed;
_forwardButton.Pressed += OnForwardButtonPressed;
_navigationHistoryService.Current.SubscribeOnThreadPool().SubscribeAwait(async (s, ct) =>
_navigationHistoryService.Current.SubscribeOnThreadPool().ObserveOnThreadPool().SubscribeAwait(async (s, ct) =>
{
await this.InvokeAsync(() =>
{

View File

@@ -67,7 +67,8 @@ public partial class ProblemsPanel : Control
treeItem.SetMetadata(0, new RefCountedContainer<SharpIdeProjectModel>(e.NewItem.Value));
e.NewItem.View.Value = treeItem;
Observable.EveryValueChanged(e.NewItem.Value, s => s.Diagnostics.Count).Subscribe(s => treeItem.Visible = s is not 0).AddTo(this);
Observable.EveryValueChanged(e.NewItem.Value, s => s.Diagnostics.Count).SubscribeOnThreadPool().ObserveOnThreadPool()
.Subscribe(s => treeItem.Visible = s is not 0).AddTo(this);
var projectDiagnosticsView = e.NewItem.Value.Diagnostics.CreateView(y => new TreeItemContainer());
projectDiagnosticsView.ObserveChanged().SubscribeOnThreadPool().ObserveOnThreadPool()

View File

@@ -250,7 +250,7 @@ public partial class SolutionExplorerPanel : MarginContainer
folderItem.SetMetadata(0, new RefCountedContainer<SharpIdeFolder>(sharpIdeFolder));
Observable.EveryValueChanged(sharpIdeFolder, folder => folder.Name)
.Skip(1).SubscribeAwait(async (s, ct) =>
.Skip(1).SubscribeOnThreadPool().ObserveOnThreadPool().SubscribeAwait(async (s, ct) =>
{
await this.InvokeAsync(() => folderItem.SetText(0, s));
}).AddTo(this);
@@ -301,7 +301,7 @@ public partial class SolutionExplorerPanel : MarginContainer
fileItem.SetMetadata(0, new RefCountedContainer<SharpIdeFile>(sharpIdeFile));
Observable.EveryValueChanged(sharpIdeFile, file => file.Name)
.Skip(1).SubscribeAwait(async (s, ct) =>
.Skip(1).SubscribeOnThreadPool().ObserveOnThreadPool().SubscribeAwait(async (s, ct) =>
{
await this.InvokeAsync(() =>
{