Skip to content

Commit

Permalink
Merge pull request #762 from mikeirvingweb/wasm-delay-fix-improve
Browse files Browse the repository at this point in the history
chore: improvement to wasm delay fix from #720
  • Loading branch information
jeromelaban authored Jun 19, 2024
2 parents 202fc82 + fb0bbf2 commit 362f9b3
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions UI/ChatSignalR/UnoChat.Client/UnoChat.Shared/ViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ private IDisposable ShouldSendThemeToThemeObserver(IObserver<string> themeObserv

private IDisposable ShouldSendModelsAddedToAllMessagesToMessageObserver(IObserver<Model> messageObserver)
{
#if !__WASM__
return Observable
.FromEvent<NotifyCollectionChangedEventHandler, NotifyCollectionChangedEventArgs>(
handler => (s, e) => handler(e),
Expand All @@ -218,24 +217,11 @@ private IDisposable ShouldSendModelsAddedToAllMessagesToMessageObserver(IObserve
.Where(args => args.Action == NotifyCollectionChangedAction.Add)
.Select(args => args.NewItems.OfType<Message.Model>().FirstOrDefault())
.Where(model => model != null)

#if !__WASM__
.Delay(TimeSpan.FromMilliseconds(10), Schedulers.Default) // Wait for the list view to have been updated
#endif
.ObserveOn(Schedulers.Dispatcher)
.Subscribe(messageObserver);
#else
return Observable
.FromEvent<NotifyCollectionChangedEventHandler, NotifyCollectionChangedEventArgs>(
handler => (s, e) => handler(e),
handler => _allMessages.CollectionChanged += handler,
handler => _allMessages.CollectionChanged -= handler)
.Where(args => args.Action == NotifyCollectionChangedAction.Add)
.Select(args => args.NewItems.OfType<Message.Model>().FirstOrDefault())
.Where(model => model != null)
.ObserveOn(Schedulers.Dispatcher)
.Subscribe(messageObserver);
#endif
}

public IDisposable Activate(IObservable<object> messageToSendBoxReturn, IObserver<string> themeObserver, IObserver<Message.Model> messageObserver)
Expand Down

0 comments on commit 362f9b3

Please sign in to comment.