Fork me on GitHub
#re-frame
<
2017-08-24
>
lumpy05:08:47

@stvnmllr2 re-com has a good type ahead component

stvnmllr214:08:48

How would I look at the app-db in the browser. I put it up on amazon, and something isn't working. So need to try to look at it in hopes of figuring something out

stvnmllr214:08:09

I tried window.re-frame in console, but it doesn't exist

stvnmllr215:08:25

maybe it got obfuscated with the uberjar compile? Guess i can put something in to print it out on the screen

yedi15:08:32

@mikethompson thanks for the tips

yedi15:08:39

that http-fx code is super simple

stvnmllr215:08:21

Thanks @roosta But that didn't work. window.re_frame is undefined

roosta15:08:46

is it advanced compiled?

stvnmllr215:08:51

but it's strange because much of the UI does work. it probably is, yes

roosta15:08:02

my guess is that the the re-frame ns is munged from advanced compiling. Don't know how I'd go about inspecting the db then. Maybe someone else knows?

stvnmllr215:08:48

ok, thanks. I'll try to turn that off and see if it helps.

stvnmllr215:08:21

@roosta Seemed the advanced compile broke some other stuff. So guessing I need to add some more js to externs?

stvnmllr215:08:41

And yes, the window.re_frame was there now

roosta16:08:08

@stvnmllr2 if you're using external js libraries probably. You could look into extern inference to save you some trouble but that has its own pitfalls. Theres a lot of info about this on the http://clojurescript.org webpage. A place to start could be here: https://clojurescript.org/reference/dependencies

stvnmllr216:08:26

yeah. I had a few js files in my proj, so had to add those. Don't understand all the details on that page, but will eventually read it and try to grok it

roosta16:08:07

its a lot to take in, i've been coding clojurescript for a while now and it still trips me up

deg21:08:38

I'm having one of those "I know it's my bug, but I don't know where to look" moments. I have a reg-sub-raw that occasionally gets into an infinite (or very long?) loop of being called; more than once per second. What's really strange is that this only seems to happen (I think) when Figwheel causes the page to reload. It then continues until I click on a button, triggering events etc. After that, it behaves fine. Judging by the speed of the loop, I assume this is some variation of my code touching something that causes reagent to refresh. But, I'm not really sure how to debug this, especially given the apparent figwheel interaction. I'm currently refactoring/cleaning all the code around this, so I may find the problem. But, I'm feeling kind of stuck, so any hints would be VERY welcome. Here's the key function in my code:

(defonce local-id-num (atom 0))

(defn local-id [path]
  (str "ID-" (swap! local-id-num inc) "-" path))

(defn firebase-on-value-sub [app-db [_ path]]
  (let [ref (fb-ref path)
        id (local-id path) ;;; ID to disambiguate multiple watches on same
                           ;;; node. (Firebase uses the handler to do this,
                           ;;; which we could use too. But, this is better
                           ;;; for debugging, at very little cost)
        callback #(>evt [::on-value-handler id (js->clj-tree %)])]
    (.on ref "value" callback #(js/alert %))
    (rv/make-reaction
     (fn [] (get-in @app-db [::cache id] []))
     :on-dispose #(do (.off ref "value" callback)
                      (>evt [::on-value-handler id nil])))))

(re-frame/reg-sub-raw :firebase/on-value  firebase-on-value-sub)

mikethompson22:08:31

@stvnmllr2 when trying to figure out problems to do with advanced compilation, be sure to use :pseudo-names true and :print-input-delimiter true and :pretty-print true

stvnmllr222:08:57

awesome. Will take a look when needed. Thanks

danielcompton23:08:32

@deg you can try using re-frame-trace to debug this

danielcompton23:08:56

It's still alpha but I think would be very helpful for this kind of situation