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

Add modal dialogs #3

Open
alfonsogarciacaro opened this issue May 2, 2019 · 4 comments
Open

Add modal dialogs #3

alfonsogarciacaro opened this issue May 2, 2019 · 4 comments

Comments

@alfonsogarciacaro
Copy link
Contributor

It'd be great to have also the possibility of creating modal dialogs as Elmish commands, maybe here or in a different package.

@MangelMaxime
Copy link
Contributor

If the modal is created using Elmish commands it will be static. Because the state can't be stored in the global model and no I don't want to speak about hook or stateful components for designing such a components ^^.

It could call a callback but probably nothing more but even then it's dangerous in development mode and could lead to broken applications.

If an HMR call is triggered while the modal is open, then the callbacks in the modal will not have the right dispatch instance and will probably just throw an error or do nothing on click.

Why do you want to create a model using a command instead of storing the state of the modal in your application and calling the modal in the view?

@alfonsogarciacaro
Copy link
Contributor Author

Well, if you have a complicated app with a view that you don't remember very well and don't want to touch very much (as it just happened to me) and you're asked to add a confirmation step for an action, it could be a nice way to quickly add the confirmation in your update function.

A static modal is ok as long as you have access to the dispatch function and another function to dismiss the modal. The HMR thing is indeed tricky but I personally could leave with that (I just refresh when I see the app behaving funny).

@alfonsogarciacaro
Copy link
Contributor Author

Zaid made me realize he has already something like that. It'd be nice to have something similar for Fulma apps :) https://zaid-ajaj.github.io/Elmish.SweetAlert/

@MangelMaxime
Copy link
Contributor

Hum...

The thing is all the modal provided by SweetAlert can only support a small kind of things. But indeed, perhaps we can try to cover the most common cases.

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

2 participants