This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-04
Channels
- # bangalore-clj (3)
- # beginners (23)
- # boot (89)
- # cider (11)
- # cljs-dev (22)
- # cljsjs (5)
- # cljsrn (21)
- # clojure (141)
- # clojure-android (1)
- # clojure-berlin (1)
- # clojure-greece (1)
- # clojure-italy (13)
- # clojure-mke (2)
- # clojure-nl (8)
- # clojure-norway (5)
- # clojure-russia (22)
- # clojure-sg (4)
- # clojure-spec (38)
- # clojure-uk (109)
- # clojurescript (150)
- # consulting (4)
- # core-async (7)
- # cursive (13)
- # datascript (8)
- # datomic (72)
- # dirac (185)
- # emacs (5)
- # figwheel (2)
- # flambo (1)
- # hoplon (13)
- # immutant (6)
- # lambdaisland (7)
- # lumo (46)
- # off-topic (13)
- # om (4)
- # onyx (1)
- # pedestal (1)
- # re-frame (68)
- # reagent (15)
- # rum (16)
- # slack-help (4)
- # spacemacs (22)
- # specter (3)
- # vim (10)
- # yada (28)
I am getting an inexplicable re-frame: no subscription handler registered for: ":test". Returning a nil subscription.
even though the :test
subscription is registered along with all the other working subscriptions in subs.sljs
.
https://github.com/Day8/re-frame/blob/master/docs/Basic-App-Structure.md#theres-a-small-gotcha
@mikethompson Thanks but that is not it. Both (except events is handlers in my setup) are already required in core and all the other subscriptions work.
@mac are you somehow registering nil
for :test
A registration of nil
(perhaps overwriting an original, good registration) would look like doesn't exist to re-frame
Yep, so:
1. (.log js/console "registration proved")
immediately after that registration prints?
2. is there any way that later on ANOTHER registration for :test
somehow provides a nil
3. what happens if you change from :test
to using :my/test
..
Just ideas
It obviously looks fine, so there's some underlying assumption that's false - like that the registration happens at all. Just trying to expose the assumption.
@mikethompson 3. makes no diff. still reports as not registred.
Running out of ideas a bit.
Put this before the registration (should be nil):
(.log js/console "before: " (re-frame.registrar.get-handler :sub :test))
And similar after. Should no longer be nil
I'm a bit worried about my code above ... is untested
Gives me:
before: null after: λ[…]λ[db query-vec]λ[db query-vec dyn-vec]jsfunction (db,query_vec,dyn_vec)
So nil before and something after
Hmm. Are you running clojure
Or ClojureScript
Pretty wierd
What happens if you do a
@(subscribe [:test])
Immediately after the registration
I'm just got this bad feeling about the registration getting overwritten with a nil So I'm trying to see if an immediate subscribe works (whereas one later fails)
@mikethompson this is very odd
Does it produce the same warning
From re-frame
re-frame: no subscription handler registered for: ":my/test". Returning a nil
Note: the subscription may well return nil
... after all app-db
doesn;t contain anything yet
So we don't much care what the subscription returns
Instead ... we are seeking to see if we see the console warning
My guess is that you are not seeing a warning
Logging the value is fine
But we don't care about the value
All we care about is if you see a warning
(about re-frame not finding a subscription handler)
I have to go to bed in a min
Do you see a warning?
If I remove the subscribe from views.cljs I see no output at all from subs, not even the before / after stuff.
Are you sure subs.cljs is being required ?
The above indicates it is not
https://github.com/Day8/re-frame/blob/master/docs/Basic-App-Structure.md#theres-a-small-gotcha
Gotta go to bed. Good luck
@mikethompson Thanks.
in the two-function version of reg-sub
, it appears that the second function doesn’t get a handle on the db. is there a reason for that?
2. (reg-sub
:a-b-sub
(fn [q-vec d-vec]
[(subs/subscribe [:a-sub])
(subs/subscribe [:b-sub])])
(fn [[a b] [_]] {:a a :b b}))
@mikethompson The issue was caching related 😞 I tried in Firefox and all worked. Now disabled caching in Chrome and works fine again.
@sashton I think the reasoning behind it is that the first function is expected to supply the second one with everything it needs
@curlyfry that’s what i ended up doing. but that means i had to write a reg-sub
just for the one extra value i needed.
hello. I’m going to have some panels and some of them should show something by id. How to pass it? Would be cool to have (re-frame/dispatch [:set-active-panel [:card-panel card-id]])
, but I’m not sure how to bind id here:
(defn panels [panel-name]
(case panel-name
:home-panel [home-panel]
[:card-panel __card-id__] [card-panel __card_id__]
Perhaps the card-panel could subscribe to the active id which is set by (dispatch [:set-active-card id])
or something similar?
@curlyfry, to my taste this would clutter app state. I’m looking into https://github.com/clojure/core.match now. I wonder why it stuck at alpha version.
@curlyfry, yes, but card-id doesn’t make sense separately when it doesn’t show card-panel
is there an out of the box example of a little re-frame repl like editor on the left hand side of the screen, results on the right?
@negaduck core.match is very interesting. Discovered (by absent-minded me) thanks to you. Begs to be used. Will find an excuse to use it in current project. 🙂