Fork me on GitHub

A question about dynamic subscriptions: If I have a subscription that takes another subscription as input but also allows for a dynamic subscription I get some strange behavior. The subscription is triggered twice, first the directly subscribed value has changed but the dynamic value (of the same subscription) is the same, but then it is triggered again and then both the directly subscribed value and the dynamically subscribed value are the same. To illustrate I have put together a simple repo:


When db is incremented it will print: Times-ten Dynamic: 0 Input: 1 Times-ten Dynamic: 1 Input: 1 (Ideally I would like to have the subscription triggered only once, and thus avoiding the first trigger (naturally it is problematic to have the same subscription deref to different values))


does anyone know how to get refs to work in reagent (is it possible?)?


Oh that's quite different 🙂 No idea with that one.


@lwhorton had the same question recently


@lwhorton the :ref key can be a function. The function gets the element as argument. You can stash that in an atom or whatever and then do stuff with it.