Cysharp / R3

The new future of dotnet/reactive and UniRx.
MIT License
2.1k stars 92 forks source link

Adds support for TimerFrameProvider to Blazor registration #176

Closed michaelstonis closed 4 months ago

michaelstonis commented 6 months ago

In Blazor there wasn't support for a FrameProvider. This adds support using the TimerFrameProvider. This appears to work out okay for the Blazor project and makes it so that features like EveryValueChanged are available. I am not sure if there are any downsides to adding this registration or if it could cause an overhead processing issue.

Ambient CPU usage doesn't seem to be greatly impacted.

image
neuecc commented 6 months ago

Thank you, and sorry for the delayed response. First of all, I want to maintain Singleton instead of Scoped. Since TimeProvider is a generic type, injecting it outside the scope of Blazor with Scoped causes issues. Therefore, I made it obtain SynchronizationContext.Current each time. A specific problematic case we encountered is coexistence with YARP. https://github.com/microsoft/reverse-proxy/blob/e672f151e1a1104a849bb24d9be94bf30dac63c9/src/ReverseProxy/Management/ReverseProxyServiceCollectionExtensions.cs#L32

I think the FrameProvider using polling is good since it's implemented for other frameworks as well.