priornix / antizer

ClojureScript library for Ant Design React UI components
Eclipse Public License 1.0
259 stars 47 forks source link

Om Next support? #4

Open Driphter opened 7 years ago

Driphter commented 7 years ago

Any chance of Om Next support being implemented?

pablinos commented 7 years ago

I'd be interested in this too. I wonder how hard it would be? Looking at how the Reagent and Rum components are defined there's a macro that builds them and is mapped to the collection of antd components.

It might be easier than we think?!?

priornix commented 6 years ago

Actually @sctianwei (thanks!) has done some work on adding Om Next support here:

https://github.com/sctianwei/antizer/commit/5247fcce4ab03351ee021ee0a5443250c7e4f7d8

However, I noticed that there's an issue. It seems like the antd library's getFieldDecorator function is not actually being called. Hence the components (eg: text input) are not clickable, until the following function is called on on-change.

(defn handle-fields-change[comp]
  (om/update-state! comp assoc :form (ant/get-form comp)))

This workaround works, but it can be error-prone since you have to call it for all the form controls and I have not tested enough to see if there are any other unexpected behaviour.

@sctianwei Could you explain what led you to do the workaround above? Thanks!

sctianwei commented 6 years ago

@priornix it's not the final solution, I do this only want the form can just work. actually, I've done some debug, the getFieldDecorator get called, the value changed at first, but somehow it get reverted after re-rending.