Giter Site home page Giter Site logo

Forms about prism HOT 7 CLOSED

jmarceli avatar jmarceli commented on June 4, 2024
Forms

from prism.

Comments (7)

jmarceli avatar jmarceli commented on June 4, 2024

I've manage to made a sample redux-form integration. Here is the repo https://github.com/jmarceli/redux-elm-form. If you will have some spare time please take a look and tell me if it suits you. If so I can make some pull requests to the documentation section and explain the integration. Probably there should be separate chapter called "Integration with other packages" or something like that.
I know that storing forms outside regular Elm tree is not the way it should be handled but this is the only (successful) way of integrating redux-form (I have no luck with trying to make separate form for each component - but it might be possible).

A couple of issues I come across while making this sample app:

  • view has to be wrapped with redux-elm/view in other case sagas won't be triggered (it might be worth documenting, if it's not yet documented)
  • forms created with redux-form are not hot reloaded, they loose all entered data during reload (I don't know how to fix this)
  • forms needs unique names, they should be somehow generated in the same way as action types, but I still didn't find any way to do this, so it is up to the developer for now
  • form data is not accessible in the updater so it has to be passed with the action, it may be possible to use redux-spy but I have no need for this right now so I didn't check if it will work (and how to integrate this)

from prism.

tomkis avatar tomkis commented on June 4, 2024

Hello, I really appreciate what you did here. I am working on this issue today and came to basically same implementation. However, I am not sure how much aware you are of v6 of redux-form since there will be many breaking changes which will basically not allow this approach.

My main concern is that in v6, only fields will be connected not the entire form, the issue is though that there's no simple way to provide the field with wrapped dispatch function. I am thinking about filing an issue to redux-form repo.

from prism.

jmarceli avatar jmarceli commented on June 4, 2024

Hi. I'm aware that it will be v6 but I didn't check how much changes it will bring. It's definitely good idea to submit an issue, but I don't know if eventually it will be necessary to provide some Elm-compatible implementation of the forms (or some kind of adapter for redux-form).

Offtopic question: Do you manage to run/deliver any production services based on redux-elm? I'm asking because I have to write an app for the client and composability of the Elm Architecture seems to be a good solution.

from prism.

tomkis avatar tomkis commented on June 4, 2024

@jmarceli after deep understanding of how redux-form works I've decided to send a PR, redux-form/redux-form#1154 let's see where it gets us.

OT answer: Yes, we are in the middle of implementing universal web app which is using redux-elm and so far we are happy with the architecture.

from prism.

jmarceli avatar jmarceli commented on June 4, 2024

Thanks for handling this issue. I think that my current level of knowledge won't allow me to create valuable pull request for redux-form project.

from prism.

jmarceli avatar jmarceli commented on June 4, 2024

@tomkis1 maybe I solve the redux-form v6 issue without any modifications to the library. Please take a look at: https://github.com/jmarceli/redux-elm-form/tree/redux_form_v6

I'm not sure if wrapping a form in subcomponent solves all the issues but it allows me to handle form submit with redux-elm custom dispatcher (which was the problem as far as I know).

from prism.

tomkis avatar tomkis commented on June 4, 2024

So we've come up with a conclusion that redux-form is quite opinionated library even in plain redux which makes it even more difficult to integrate with redux-elm. Maybe more focused library would do the trick better.

from prism.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.