mrpmorris / Fluxor

Fluxor is a zero boilerplate Flux/Redux library for Microsoft .NET and Blazor.
MIT License
1.25k stars 144 forks source link

Does Fluxor work with prerendering? #256

Closed umunu closed 2 years ago

umunu commented 2 years ago

I was using the library without prerendering and everything works as expected. When I enabled prerendering the fluxor part wasn't working until the page is "loaded" through the wasm pipeline. There was the issue #146 which refer to the same problem and has a commit that closes it but I couldn't follow how this commit enables prerendering. Is there somewhere in documentation that I am missing that describes how fluxor can be used along with prerendering? Or more importantly, can Fluxor be used with prerendering?

mrpmorris commented 2 years ago

I've not tried, but you might be able to manually initialize the store to make it work. You'd have to remove the StoreInitializer component from your view.

Please let me know the outcome.

umunu commented 2 years ago

The problem I see by manually initializing the store is the duplication of logic this involves. E.g. Lets say I load something in the OnInitializedAsync method by dispatching an action that is registered in an effect. If it succeeds a LoadSuccessAction is dispatched, if it fails a LoadFailAction is dispatched. With manual initialization this logic has to be written a second time without the dispatchers and actions.

mrpmorris commented 2 years ago

Ah yes, the actions are fire and forget, and that is a deliberate part of the pattern

mrpmorris commented 2 years ago

I'm closing this ticket. It doesn't support it and I don't think the pattern would allow it to.

davicbaba commented 8 months ago

i'm using fluxor in many projects and its awesome but now i need to implement pre-rendering to improve SEO. The only way is to remove flux from my project.

It would be awesome if fluxor supports pre-rendering :(