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

Question regarding adapt-class implementation #25

Open
tacticiankerala opened this issue Sep 26, 2018 · 0 comments
Open

Question regarding adapt-class implementation #25

tacticiankerala opened this issue Sep 26, 2018 · 0 comments

Comments

@tacticiankerala
Copy link

tacticiankerala commented Sep 26, 2018

I was trying to get the following snippet to work in RUM,

(def menu-items [{:key "home"
                  :title "Home"
                  :icon "smile"}
                 {:key "about-us"
                  :title "About Us"
                  :icon "smile"}])

(defn menu []
  (ant/menu
   {:theme "dark" :mode "inline" }
   (for [{key :key title :title icon :icon} menu-items]
     (ant/menu-item
      {:key key}
      (ant/icon {:type icon})
      [:span.nav-text title]))))

But, it was not showing up. Digged a bit into the implementation of adapt-class and found this,

...
type# (first children)

new-children (if (sequential? type#)
                       [(sablono.interpreter/interpret children)]
                       children)

vector->react-elems (fn [[key val]]
                              (if (sequential? val)
                                [key (sablono.interpreter/interpret val)]
                                [key val]))
...

So, I went ahead changed that to the following and everything started working fine(at least for me 😄 )

...
new-children (sablono.interpreter/interpret children) 

vector->react-elems (fn [[key val]]
                                      [key (sablono.interpreter/interpret val)])
...

I think sablono already handles all the cases were input being vector, seq, object etc.. So, this is sufficient for the functionality right?

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

1 participant