Fork me on GitHub
#re-frame
<
2020-10-26
>
Endre Bakken Stovner20:10:37

I have the following subscription:

(rf/reg-sub
 :highlight/result

 (fn [query-v]
   [(rf/subscribe [:fields/path]) (rf/subscribe [:fields/structure])])

 (fn [[fields structure] query-v]
   (js/console.log (str "Hi from reg-sub: " (type fields)))
   (js/console.log (str "Hi from reg-sub: " (type structure)))
   (str (highlight fields structure))))
When I try to print the types above I get Hi from reg-sub: function (meta,cnt... I expected both types to be a Clojure data structure. Is it to be expected that they are functions? I suspect it is an indication I am doing something wrong. Dunno what

Endre Bakken Stovner20:10:43

https://github.com/endrebak/ouija/blob/master/src/cljs/ouija/events.cljs#L61 is where the weirdness happens if anyone is interested in taking a look 🙂

p-himik22:10:32

I cannot run your project:

could not find a non empty configuration file to load. looked in the classpath (as a "resource") and on a file system via "conf" system property

p-himik22:10:03

It wants dev-config.edn that hasn't been checked into the repo.

p-himik22:10:02

Ah, got it running. And now I realize what's wrong. In hindsight, I should've seen it from the code. Keywords are functions. That's it. Don't wrap the arguments to js/console.log in str - you will see proper types if you're using cljs devtools.

p-himik22:10:25

(`js/console.log` accepts any amount of arguments)

Endre Bakken Stovner18:11:12

Thank you for bothering to reply! It is very kind of you 🙂

Endre Bakken Stovner18:11:29

I have not had time to work on personal stuff until now, that is why no reply 🙂

Endre Bakken Stovner18:11:51

You are absolutely correct about dev-config. I wonder why it is not checked in by default.