Fork me on GitHub
#re-frame
<
2021-10-14
>
andrzejsliwa12:10:11

Hey, do you know why re-frame-10x isn’t picking up the changes (after opening page first time)? I’m using shadow-cljs…

andrzejsliwa12:10:34

after changing something in code the past changes also appearing

andrzejsliwa12:10:55

also re_frame.db.app_db.state is showing, that changes were applied

andrzejsliwa12:10:09

but re-frame-10x isn’t reflecting it in UI.

p-himik12:10:59

The re-frame-10x panel has to be open before you make a change. Same thing as with the Network tab in the DevTools - it won't show any previous requests, only the ones that will be issued when the DevTools panel is open.

p-himik12:10:19

If that's not what you're experiencing, please create a minimal reproducible example.

andrzejsliwa12:10:27

I was wonder if there is the way to tell 10x to be loaded before :dev/after-load is triggered

p-himik14:10:02

Can tell for sure, but can you try opening it in a separate window and see if that works for you? There's a button for that.

rberger21:10:16

In the re-frame api docs on reg-sub, it talks about the signal function

(fn [query-vec dynamic-vec]
   [(subscribe [:a-sub])
    (subscribe [:b-sub])])
What is dynamic-vec ? I couldn’t find a definition of that in that doc? Is it the same as the third argument to subscribe as described in the API docs? > an optional 3rd argument, which is a vector of further input signals (atoms, reactions, etc), NOT values. This argument exists for historical reasons and is borderline deprecated these days.

lispers-anonymous21:10:55

It is a list of reactive values (ratoms, reactions, etc) that can be provided when you call subscribe. They will be dereferenced and passed in a list as the third argument to your subscription handler. In the input signal function I do not believe they are de-referenced for you. Something like this might illustrate. (I did not test, just wrote it out here)

(rf/reg-sub
 :asdf
 (fn [db [_ foo] [r1 r2]] 
  (and (= foo "foo")
       (= r1 :ratom1)
       (= r2 :ratom2))))

@(rf/subscribe [:asdf "foo"] [(r/atom :ratom1) (r/atom :ratom2)]) ;; => true

rberger21:10:19

Thanks! Is it also a depreciated use case now and I can pretty much just ignore it? Or is there use cased it might be interesting to use?

lispers-anonymous21:10:42

I'm not sure what the official stance is, but I would treat it as deprecated since this feature isn't really documented anymore. I've personally never found a use case for it. This page has some reading you may find interesting: https://github.com/day8/re-frame/wiki/Dynamic-Subscriptions

p-himik21:10:51

No such use cases exist - IIRC subscription caching has made this feature completely unnecessary.

☝️ 1
👍 1