Fork me on GitHub
#keechma
<
2018-04-03
>
mihaelkonjevic17:04:26

If you’re using Keechma toolbox in your projects, check out this commit https://github.com/gothinkster/clojurescript-keechma-realworld-example-app/commit/25524160210946064a1faae092b47ae8f9f8c551 which updates the project to the latest APIs from Keechma toolbox. Biggest changes are how forms work and how are keechma toolbox libraries being used. Dataloader and forms now have install functions which will wire up all the controllers, subscriptions etc. needed for the lib to work correctly. The API is a bit more “magical” now, but I think that the codebase is more clear. Here you can see how you would wire up dataloader and forms https://github.com/gothinkster/clojurescript-keechma-realworld-example-app/blob/master/src/cljs/realworld/core.cljs#L13-L23 and here you can see the new forms (UI) API in action https://github.com/gothinkster/clojurescript-keechma-realworld-example-app/blob/master/src/cljs/realworld/ui/components/pure/form_inputs.cljs#L47-L56

👀 1
mihaelkonjevic18:04:19

If you are wondering how can these components access the form state, forms’ install function adds form-state subscription dependency to all registered components (https://github.com/keechma/keechma-toolbox/blob/master/src/cljs/keechma/toolbox/forms/app.cljs).

mihaelkonjevic18:04:31

This means that you don’t have to manually subscribe to the form-state subscription in your components anymore (https://github.com/gothinkster/clojurescript-keechma-realworld-example-app/blob/master/src/cljs/realworld/ui/pages/settings.cljs - no more subscription deps). While I don’t usually like these kind of magical APIs I feel that forms are a somewhat special case, especially because they are implemented across form records, controllers and subscriptions. This way the implementation details are not leaking out