achikin 2021-03-25T11:49:17.028200Z

It helps a lot if [:_id] is not just a path in the db, but a rather complicated subscription which is not easy to replicate as a function from db

achikin 2021-03-25T11:52:40.028400Z

It looks like you’re using some js components and it’s hard to tell how exactly they treat the values you pass inside them.

achikin 2021-03-25T12:00:02.028600Z

From what you saying, it looks like the subscriptions are working fine.

achikin 2021-03-25T12:01:50.029300Z

(def db {:form {:entity-id 1}

  :<- [:a lot]
  :<- [:of]
  :<- [:signals]
  (fn [[yada yada yada] [_ entity-id]]
    (some (really (complicated code))))

  (fn [db [_ form-path]]

(defn my-form []
  (let [form-path :form
        entity @(re-frame/subscrible [::get-entity-from-form form-path])]
    [render-entity entity]))
I have some really complicated subscription with a lot of input signals, which extracts some entity from the db which I can’t replicate as a function of db. Also I have a form stored in the db, which has that entity id inside it. I want a subscription which given a form path gives me back entity (marked with ??????? in the code above). So, essentially what I want to do : 1. given path to form extract :entity-id 2. use that :entity-id as an input to ::get-some-entity and I want to do all of that inside subscriptions, without passing data through the form rendering. Is that possible in re-frame?

p-himik 2021-03-25T13:00:05.029500Z

I'm pretty sure you can safely use @(subscribe ...) within the reg-sub handler. Alternatively, use reg-sub-raw.

Adriaan Callaerts 2021-03-25T15:47:08.030700Z

Is there a way to check if a subscription is already registered given a query-id?

Adriaan Callaerts 2021-03-25T15:49:52.030800Z

I figure I could use the re-frame.registrar namespace functionality, but that feels like relying on internal api too much

p-himik 2021-03-25T15:54:33.031Z

It is internal. But I don't think there's any other way.