Fork me on GitHub
#fulcro
<
2017-10-25
>
claudiu06:10:23

Looks awesome 🙂

claudiu06:10:29

will the new website have a .com domain ?

tony.kay06:10:58

I don’t plan on hosting it elsewhere at the moment. The com enterprise is the consulting company. fulcro itself is open source non-commercial.

roklenarcic07:10:12

Will project migrate to react as a NPM dependency in the future?

wilkerlucio12:10:40

@sundarj root can't have an ident

wilkerlucio12:10:52

it doesn't work, you have to wrap it

sundarj12:10:00

@wilkerlucio ah, so i need to move the form out into its own component?

wilkerlucio12:10:33

yeah, what I do is have a default root that I use on my apps to wrap my actual root

wilkerlucio12:10:35

something like this:

wilkerlucio12:10:38

(om/defui ^:once Root
  static fulcro/InitialAppState
  (initial-state [_ _] {:ui/react-key (random-uuid)
                        :ui/root      (fulcro/get-initial-state ActualRoot {})})

  static om/IQuery
  (query [_] [{:ui/root (om/get-query ActualRoot)}
              :ui/react-key])

  static css/CSS
  (local-rules [_] [])
  (include-children [_] [ActualRoot])

  Object
  (render [this]
    (let [{:keys [ui/react-key ui/root]} (om/props this)]
      (dom/div #js {:key react-key}
        (actual-root root)))))

wilkerlucio12:10:56

this is a good pattern to follow, because this way you root gets easier to be plugged in another system

sundarj12:10:06

i see, that makes sense. thanks!

wilkerlucio12:10:30

@sundarj pro tip: if you find yourself having to do it too much, this function can help:

wilkerlucio12:10:33

(defn make-root [Root]
  (om/ui
    static fulcro/InitialAppState
    (initial-state [_ params] {:ui/react-key (random-uuid)
                               :ui/root      (fulcro/get-initial-state Root params)})

    static om/IQuery
    (query [_] [:ui/react-key
                {:ui/root (om/get-query Root)}])

    static css/CSS
    (local-rules [_] [])
    (include-children [_] [Root])

    Object
    (render [this]
      (let [{:ui/keys [react-key root]} (om/props this)
            factory (om/factory Root)]
        (dom/div #js {:key react-key}
          (factory root))))))

wilkerlucio12:10:48

on this, you send the component, and it generates Root wrapping your component, so you don't have to write it every time

sundarj12:10:04

@wilkerlucio oh, neat! thanks a lot 🙂