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 RemoteData wrapper? #1

Open
popara opened this issue Jan 7, 2020 · 3 comments
Open

Add RemoteData wrapper? #1

popara opened this issue Jan 7, 2020 · 3 comments

Comments

@popara
Copy link

popara commented Jan 7, 2020

Hi,
I have been playing with your libraries and I find them really pleasurable to work with. Only thing that is holding me back to implement it in my main project is the fact that I am using heavily
RemoteData package:
https://package.elm-lang.org/packages/krisajenkins/remotedata/latest

Do you think that there is a possibility to generate client code wrapped with RemoteData, and are you open or PRs in this area?

Thanks!

@ollef
Copy link
Collaborator

ollef commented Jan 7, 2020

Hey!

Glad to hear you're enjoying the libraries so far. :)

I'd be open for it if there's a way to add it that doesn't force everyone to use it.

The reason it's preferrable (IMO) for the generated endpoints to return Result instead of RemoteData is that RemoteData is "too big", i.e. the endpoints never return NotAsked or Loading. If you're pattern matching on the returned value in your update function, you'd have to add cases that can never really happen if you used RemoteData.

With that said, we sometimes find it convenient to use RemoteData anyway, probably for the same reason as you. In those cases we usually use something like Cmd.map (SomeMessage << RemoteData.fromResult)

@popara
Copy link
Author

popara commented Jan 7, 2020

Cool.

I totally agree with your reasoning, RemoteData should be whipped cream on top of this cake.

I will see to work this and next week on a version that will have a option to generate RD endpoints.

@popara
Copy link
Author

popara commented Jan 7, 2020

BTW, usually I just save webdata to my model, and display result accordingly. If I need to work out details, I simply RemoteData.map, hence I dont work with case statements in update

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