derivatives unavailable in `will-unmount` if the latter is placed after the former.
Affects get-ref.
If I understand the source correctly, this is because the derivatives mixin always includes unmount code. You can call the custom will-unmount before the derivatives mixin, but as a project gets more complex, it could lead to code that is difficult to reason about. Something more explicit could be worth exploring.
I have two suggestions:
- Split the derivatives mixin into separate mount and unmount functions/vars
- Include an optional
will-unmounthook into thed/drvmixin that will get called before the mixin executes its own unmount.
Can you maybe add a code snippet that illustrates the problem? :)
On Mon, Jun 5, 2017, 23:15 Levi Tan Ong [email protected] wrote:
Affects get-ref.
If I understand the source correctly, this is because the derivatives mixin always includes unmount code. You can call the custom will-unmount before the derivatives mixin, but as a project gets more complex, it could lead to code that is difficult to reason about. Something more explicit could be worth exploring.
I have two suggestions:
- Split the derivatives mixin into separate mount and unmount functions/vars
- Include an optional will-unmount hook into the d/drv mixin that will get called before the mixin executes its own unmount.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/martinklepsch/derivatives/issues/12, or mute the thread https://github.com/notifications/unsubscribe-auth/AAF82BMlgHwozS-2AXC3PRMjavKqzWNhks5sBCmogaJpZM4NwQU0 .
Sorry for taking so long, I've been quite busy these past few days.
(defcs sample
<
rum/reactive
(d/drv :app/data)
#?(:cljs
{:will-mount (fn [state]
;; we have access to derivatives
state)
:will-unmount (fn [state]
;; no access to derivatives
state)})
[state]
nil)