madvas / cljs-react-material-ui

Clojurescript library for using material-ui.com
Eclipse Public License 1.0
205 stars 32 forks source link

Fix camel-case conversion for nested vectors #9

Closed edpaget closed 8 years ago

edpaget commented 8 years ago

The map-entry? method may sometimes try to convert the first element of a vector property for a mui component (such as :nested-list or :actions) to camel case resulting in errors when the value isn't nameable.

This patch changes the prewalk to a postwalk that first tests for a map then maps over its keys applying the camel case function.

As an example I had this code that was erroring before my patch:

(mui/dialog {:title "Delete?"
             :key "dialog"
             :modal false
             :open (om/get-state this :open-delete)
             :actions [(mui/raised-button {:label "Back"
                                           :key "back"
                                           :on-touch-tap #(om/update-state! this assoc :open-delete false)})
                       (mui/raised-button {:label "Delete"
                                           :key "delete"
                                           :on-touch-tap #(delete-and-redirect this)})]
             :on-request-close #(om/update-state! this assoc :open-delete false)})
madvas commented 8 years ago

You're correct, thank you!

edpaget commented 8 years ago

Thanks for the quick turnaround!

smnplk commented 8 years ago

I think I have the same problem on latest release (0.2.21), any chance there will be a new release any time soon ?

madvas commented 8 years ago

I released now 0.2.22, replacing custom made transforms with https://github.com/qerub/camel-snake-kebab . It should be bug free now

madvas commented 8 years ago

Oh dammit I must have forgotten that. Too bad I won't be able to do that until Saturday, sorry. But if you really need that you can copy paste that overwritten function into your code meanwhile. On Fri, 23 Sep 2016 at 21:09, Simon Polak notifications@github.com wrote:

I think I have the same problem on latest release (0.2.21), any chance there will be a new release any time soon ?

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/madvas/cljs-react-material-ui/pull/9#issuecomment-249290329, or mute the thread https://github.com/notifications/unsubscribe-auth/ADrbAx382CS6TkYJxWJbhswTvIeyhGl4ks5qtDINgaJpZM4IvFZD .