Hi Dan -
Super intrigued by this and if there was something I would get involved in it would be state management. I'm not super confident and will want to make sure I can be productive before trying to help, I can say I'm passionate about this. I have benefitted greatly from Microsoft's work in open source, and state management specifically.
One project I want to make you aware of is ReSub (by the Skype team I believe)..
https://github.com/Microsoft/ReSub
I have used this with prior iterations of Steve Sanderson's JavaScriptServices SPA templates for React. With Typescript's decorators it is a super clean experience especially when you compare it to Redux (cumbersome boilerplate code).
I will be reviewing the contribution guide and see if I can push on with some sort of paradigm similar to ReSub.. If I can't I'm sure the uber smart folks that will eventually jump in on your 'official experiment' will find some nice ways to get this done.
I would love for this project to have state management that works like MobX (https://github.com/mobxjs/mobx). What I really love about MobX is that everything "just works", MobX tracks which components accessed what data and when that data is changed re-renders them. The best developer experience I've ever had!
@SteveSandersonMS is on vacation right now but I'll answer for him based on previous discussions...
This is something we're thinking about but not planning to build immediately. Blazor as it is it independent of a state management library.
What would be great would be to see a few community members take a stab at building something, and we can all learn from that.
I was thinking state management via Microsoft Orleans.
On Sun, Mar 25, 2018, 6:53 PM Ryan Nowak notifications@github.com wrote:
@SteveSandersonMS https://github.com/SteveSandersonMS is on vacation
right now but I'll answer for him based on previous discussions...This is something we're thinking about but not planning to build
immediately. Blazor as it is it independent of a state management library.What would be great would be to see a few community members take a stab at
building something, and we can all learn from that.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/aspnet/Blazor/issues/27#issuecomment-376013941, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAvMbAWRka1dLHe7YGAO2WxcWQ8hqL3qks5tiC4TgaJpZM4RtM2a
.
I second something akin to Mobx
.NET has INotifyPropertyChanged
and INotifyCollectionChanged
so you can implement your own state / change detection based on them.
I have created a very simple demo application to demonstrate it.
It would be nicer though to only track changes on used properties instead of all of them.
There is a Redux implementation available here:
https://github.com/torhovland/blazor-redux
It would be cool to also see something with automatic change tracking similar to Mobx using INotifyPropertyChanged
.
I make this example inspired with MobX with using INotifyPropertyChanged.
Most of boilerplate around INotifyPropertyChanged is generate with PropertyChanged.Fody which look great.
And observabed properties are mark like this.
@functions
{
[Observable]
public Passenger Passenger { get; set; }
}
Also you can use if you want observed only some properties.
[Observable(nameof(Models.Passenger.FirstName))]
@jirisykora83 That's extremely interesting! Thanks for letting us know. @danroth27 We should consider this when we come up with designs for state management.
@SteveSandersonMS If i understand correctly you are considering "Middleware for component activation and parameter passthrough" in #1 . If you decide to implement this then could be possible to add some state management without inhering from BlazorComponent
(if we get option to call re-rendering from middleware).
I think it would be nice if you can just write something like app.UseStateX();
or app.UseBlazorRedux()
in startup and do not need to inherits from same base component how most of the concept currently do.
@johot @JohnLouderback @campersau @jirisykora83 @SteveSandersonMS
Guys, I've created IL-instrumentation-based MobX "clone": https://github.com/kekekeks/NObservable
Unlike INotifyPropertyChanged
-based approaches it tracks observed properties automatically and isn't limited to the component itself (it can observe changes from anywhere in the application)
It doesn't support all MobX's features yet, but @observable
, autorun
, when
and runInAction
counterparts are already available.
I've also integrated it with Blazor, the app and component structure looks like this. Basically you add @implements IObserverComponent
to your component and NObservable will instrument BuildRenderTree
and add its own ShouldUpdate
implementation.
The following repo is pretty interesting : https://github.com/TimeWarpEngineering/blazor-state, uses MediatR
.
@rynowak This issue doesn't appear on the roadmap's backlog issue list: https://github.com/aspnet/AspNetCore/issues/8177
Closing this issue as we have nothing concrete proposed here. If there is something specific you believe should be done here please file a new issue with your specific proposal.
Most helpful comment
I would love for this project to have state management that works like MobX (https://github.com/mobxjs/mobx). What I really love about MobX is that everything "just works", MobX tracks which components accessed what data and when that data is changed re-renders them. The best developer experience I've ever had!