Fork me on GitHub
#reagent
<
2016-01-19
>
hugobessaa01:01:11

Have anyone tried something like http://cycle.js.org using ratoms as signals?

mikethompson01:01:35

I started out very enthusiastic about cycle.js and motorcycle.js, but my interest has waned a bit. I see reports that it is hard to "observe" the values in the system. Hard to debug when state is spread around (in a stateful signal graph), even when that graph/state is reactively updated. Better tooling will help, no doubt, but anything that encourages distributed state gets my spidey senses tingling.

mikethompson01:01:31

Don't get me wrong, I'm massively in favor of reactive approaches. It has changed my life. But I'm starting to think that we have to be careful to not let the this new pendulum swing too far. (I reserve the right to utterly change my mind all this ... my understanding is still evolving and I'm a very slow thinker :-))

mikethompson02:01:22

--------------- Dear all, consider using Dirac https://github.com/binaryage/dirac ----------------

hugobessaa02:01:35

My understanding is still evolving too. I'm deeply interested in fractal architectures, but all this state spread across the application concerns me too

sooheon08:01:52

@gadfly361: Hey I have another question about soda usage with re-frame. My button looks something like this, and I have it look to see if the form submission is being processed, in which case it should disable submit, become a loading button, and change text. The disable and the text changing work, but the button doesn’t change to loading. Is the :soda map not reactive?

(defn testing []
  (let [form-data (rf/subscribe [:log-in-form])]
    (fn []
      [s/button {:soda {:type :primary
                        :fluid? true
                        :state (if (:-processing @form-data) :loading :default)}
                 :type "submit"
                 :disabled (:-processing @form-data)}
       (if (:-processing @form-data)
         "로그인중..."
         "로그인")])))

mikethompson11:01:33

@sooheon: Your code looks fine to me although using a keyword with a leading dash seems odd :-processing To debug, try this technique (I know nothing about soda):

(defn testing []
  (let [form-data (rf/subscribe [:log-in-form])]
    (fn []
      (let [soda   {:soda {:type :primary
                           :fluid? true
                           :state (if (:-processing @form-data) :loading :default)}
                    :type "submit"
                    :disabled (:-processing @form-data)}]
        [:div            ;;  <-- new enclosing 
          [:pre (pr-str @form-data)]      ;; <--  see what's in it
          [:pre (pr-str soda)]            ;; <--  see what's in it
          [s/button
               soda
              (if (:-processing @form-data)
                "로그인중..." 
                "로그인")]]))))
(untested)

sooheon15:01:50

@mikethompson: thanks for the tip! having the subscription data there like that does scratch an itch. I got the leading dash thing from pupeno’s ninjatools, just a convention, maybe unnecessary.

gadfly36119:01:55

Only have a second (will be back on soon), but soda is not reactive unless you pass in a :ratom and a :path

gadfly36119:01:21

@sooheon I only have two examples in the docs so far. First is on an_overview_card (at the bottom). Second is on the button_card, the toggle example.