Last active
March 15, 2021 14:14
-
-
Save dmitryn/eff1ac30948913490f6feff396f26b9f to your computer and use it in GitHub Desktop.
inject-sub-cofx deref issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns inject-sub-cofx | |
(:require [re-frame.core :refer [reg-sub subscribe])) | |
(reg-sub :bar | |
(fn [db] | |
(count db))) | |
(reg-sub :foo | |
(fn [_] | |
(subscribe [:bar])) | |
(fn [a _] a)) | |
(comment | |
(def sub (subscribe [:foo])) | |
(deref sub) | |
(.-watching sub) ;; => nil | |
(reagent.ratom/dispose! sub) | |
(filter #(= :bar (get-in % [0 0 0])) @re-frame.subs/query->reaction) ; => ([[[:bar] []] #object[reagent.ratom.Reaction {:val 67}]])) | |
(reagent.ratom/run sub) | |
(.-watching sub) ;; => #js[#object[reagent.ratom.Reaction {:val 67}] #object[reagent.ratom.Reaction {:val 67}]] | |
(reagent.ratom/dispose! sub) | |
(filter #(= :bar (get-in % [0 0 0])) @re-frame.subs/query->reaction)) ;; => () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment