Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using with Elmish.WPF #15

Open
JordanMarr opened this issue Jan 15, 2019 · 9 comments
Open

Using with Elmish.WPF #15

JordanMarr opened this issue Jan 15, 2019 · 9 comments

Comments

@JordanMarr
Copy link

JordanMarr commented Jan 15, 2019

First off, this looks like a very nice project, complete with documentation and examples!

For my question, I would like to incorporate the use of Rx observables in an Elmish.WPF app. Can I achieve this by using Elmish.Reaction? Also, are you going to put Elmish.Reaction on NuGet?

@dbrattli
Copy link
Owner

Hi, I will check out the possibility of releasing the separate Elmish.Reaction NuGet. Where can I find a sample Elmish.WPF app to play with?

@JordanMarr
Copy link
Author

This is the kind of stuff I was trying to do:
https://gist.github.com/JordanMarr/42297f872e470de4544e71de0c4164df

I managed to get it working via "|> Program.withSubscription rxSubcription", but I don't know if that's really the best/right way to do it.

Currently I am experimenting with Fabulous, but I am still very much interested in the best way to do Rx.

@dbrattli
Copy link
Owner

Been busy, but I have some plans for this during the next week

@wilsoncg
Copy link

wilsoncg commented May 6, 2019

+1 for using Elmish.Streams with Elmish.WPF.

It looked like it was possible, but then looking at the examples/samples, unfortunately it looks it was created with Fable only in mind.

@TysonMN
Copy link

TysonMN commented Sep 3, 2019

I am also interested in using Elmish.Stream with Elmish.WPF.

Where can I find a sample Elmish.WPF app to play with?

Clone the Elmish.WPF repo and look at the projects in the Sample folder. The simplest example is called SingleCounter.

@dbrattli
Copy link
Owner

Project renamed back to Fable.Reaction and is now using React hooks instead of stitching itself into the Elmish event loop. Not sure if there is anything similar to Hooks in WPF, but I'm afraid that this will make it harder to integrate with WPF. The preview Elmish.Streams have been moved to a separate branch for now.

@NickDarvey
Copy link

NickDarvey commented May 21, 2020

It seems like you're leaning toward tighter integration with Fable (given the name change) but as there's a few projects out there now using Elmish but not Fable, might you have any appetite for considering a separation of Reaction from Fable? I am not familiar with this codebase, so maybe it's easy enough just to reintegrate your AsyncRx with whichever flavour of Elmish one is using.

Edit: Or could you speak more about why you switched to using React hooks instead of using the Elmish event loop? (So I don't make the same mistake if I try to use AsyncRx with https://github.com/fsbolero/Bolero

@dbrattli
Copy link
Owner

Elmish does not support or even want extensions like this. Thus it was a "hack" that got increasingly harder to maintain with the fear of the loopholes being used getting changed or closed. As a React component we live our own life (event loop) together with Elmish, Feliz or on our own.

I think I will move AsyncRx to it's own repo soon to make it easier to do tagged releases with GitHub Actions. Feel free to use Asyncx with Bolero. I would however consider using the same strategy there, i.e see if it's possible to make a Reaction Razor/Bolero Component that is separate from Elmish, but find a way to communicate e.g dispatch messages back into the Elmish event loop, and with React we use props the other way.

@NickDarvey
Copy link

That's a very good insight, thank you for sharing. I've added AsyncRx to my project, I'll see if I can use a similar pattern to what you've done here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants