This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-22
Channels
- # announcements (2)
- # beginners (42)
- # calva (2)
- # cider (13)
- # clara (2)
- # cljdoc (1)
- # cljs-dev (8)
- # clojure (118)
- # clojure-australia (1)
- # clojure-europe (3)
- # clojure-finland (2)
- # clojure-italy (42)
- # clojure-japan (1)
- # clojure-nl (2)
- # clojure-spec (26)
- # clojure-uk (58)
- # clojurescript (83)
- # cursive (6)
- # data-science (2)
- # datomic (13)
- # devcards (2)
- # duct (9)
- # figwheel-main (4)
- # fulcro (11)
- # graphql (51)
- # jobs (1)
- # juxt (14)
- # kaocha (1)
- # off-topic (24)
- # re-frame (65)
- # reagent (4)
- # reitit (19)
- # remote-jobs (8)
- # shadow-cljs (50)
- # specter (3)
- # speculative (1)
- # vim (5)
- # yada (50)
I believe that is very close to what you're asking: https://github.com/nathell/clj-tvision >This is a re-frame app. >But it doesn’t use Reagent. Or React. In fact, it’s not a web app at all. > It is a console app. As in, a text-mode app that runs in a terminal. In Clojure. No ClojureScript involved whatsoever. > (OK, I lied. It doesn’t run in a real terminal. It emulates one, in Swing, using clojure-lanterna.)
SImple answer: no.
you’ll need to come up with your own way of subscribing and propagating updates to parts of your app
FWIW I have a couple codebases where I ripped out all of reagent from re-frame and just use the event and effects system and it works quite well for my needs
I believe that is very close to what you're asking: https://github.com/nathell/clj-tvision >This is a re-frame app. >But it doesn’t use Reagent. Or React. In fact, it’s not a web app at all. > It is a console app. As in, a text-mode app that runs in a terminal. In Clojure. No ClojureScript involved whatsoever. > (OK, I lied. It doesn’t run in a real terminal. It emulates one, in Swing, using clojure-lanterna.)
Trying to add re-frame-10x
to an existing cljs project and I’m seeing the following error:
---- Could not Analyze resources/public/js/compiled/out/day8/re_frame_10x/subs.cljs ----
No such namespace: mranderson048.re-frame.v0v10v2.re-frame.core, could not locate mranderson048/re_frame/v0v10v2/re_frame/core.cljs, mranderson048/re_frame/v0v10v2/re_frame/core.cljc, or JavaScript source providing "mranderson048.re-frame.v0v10v2.re-frame.core" (Please check that namespaces with dashes use underscores in the ClojureScript file name)
Deps:
[cljsjs/react "16.4.1-0"]
[re-frame "0.10.6"]
[day8.re-frame/re-frame-10x "0.3.4-react16"]
[reagent "0.8.1"]
:profiles :dev :dependencies
contains [day8.re-frame/re-frame-10x "0.3.4-react16"]
Can you try lein deps :tree
and see what it recommends? (Assuming you’re using lein
)
sounds like a version mismatch somewhere
:cljsbuild :builds :compiler
contains :optimizations :none
and :closure-defines {"re_frame.trace.trace_enabled_QMARK_" true goog.DEBUG true}
@manutter51 Will do
I’ve got one version of re-frame
and one version of re-frame-10x
in the deps tree. I see no mention of mranderson
which sounds like the problem.
Seems like lein
should be pulling that dependency since it’s mentioned in the :plugins
for re-frame-10x
.
Do you have any recommended exclusions for reagent or re-frame?
Negative
Also, are you sure you need to include [cljsjs/react "16.4.1-0"]
? We’re not using that in our re-frame project
I’m not sure if we need to use that version, happy to try and different one. What version do you use?
We don’t have a reference to react at all, we just let re-frame/reagent pull in what they need.
For reference, here’s bits of what’s in our current project:
:dependencies
[org.clojure/clojure "1.9.0"]
[org.clojure/clojurescript "1.10.238" :scope "provided"]
[re-frame "0.10.5"]
[reagent "0.8.0"]
...
:profiles
{:project/dev
:dependencies [
[day8.re-frame/re-frame-10x "0.3.3"]
[day8.re-frame/tracing "0.5.1"
:exclusions [[org.clojure/clojure]]]
I tried removing the [cljsjs/react "16.4.1-0"]
dep, still fails in the same way. Upgraded Leiningen too.
I’ll try matching your exact versions to see if that solves it.
That worked! Thanks @manutter51. There must have been some type of version mismatch issue.
Cool :thumbsup:
It’s the version of re-frame-10x
. When I bump it to day8.re-frame/re-frame-10x "0.3.4"
I see the error.
Interesting
Figured it out from the CHANGELOG
[0.3.6] - 2018-12-11
Fixed broken merges in 0.3.4 and 0.3.5 when updating the bundled version of re-frame.
[0.3.5] - 2018-12-06
Fixed
Attempted to fix the namespaces when updating the bundled version of re-frame, but we didn't fix everything, so this release should not be used.
The latest version mentioned in the README is 0.3.4
however the latest version in the CHANGELOG is 0.3.6
. I just confirmed that 0.3.6
works, looks like a simple PR to the README.
Hi, I am just trying out 10x. I have deps: ` :dependencies [[org.clojure/clojure "1.9.0"] [org.clojure/clojurescript "1.10.238"] [org.clojure/core.async "0.4.474"] [figwheel-sidecar "0.5.15"] [re-frame "0.10.6"] [day8.re-frame/re-frame-10x "0.3.4-react16"] [reagent "0.8.1"] [orchestra "2018.09.10-1"] [district0x/re-frame-spec-interceptors "1.0.1"]]`
Oops, no, I am getting No such namespace: mranderson048.re-frame.v0v10v2.re-frame.core, could not locate mranderson048/re_frame/v0v10v2/re_frame/core.cljs, mranderson048/re_frame/v0v10v2/re_frame/core.cljc, or JavaScript source providing "mranderson048.re-frame.v0v10v2.re-frame.core"
That’s the same issue I was seeing @tomayerst. If you use 0.3.6
you shouldn’t see that error.
PR to fix the README here: https://github.com/Day8/re-frame-10x/pull/227
sweet! [day8.re-frame/re-frame-10x "0.3.3-react16"]
works. Right, back to @ericnormand and "Understanding Re-frame" 😀
Nice! Eric’s not only a great guy, he also designs some really good educational materials. I had the pleasure of working with him in the past and would love to again.
Yeah, lovin' his stuff. I like it that you watch the thinking going on (and that its clear and well explained too!)
As mentioned you should be using 0.3.6, not going backwards.
Can someone refresh my memory. There was a way to pull a sub value in an event-fx, right? Similar to :<-
syntax for subs
I guess It came out a bit confusing… so what I want is something like this:
(rf/reg-event-fx
::foo
:<- [:bar]
(fn [{:keys [bar} _] ,,,, )
But of course that kind of syntax wouldn’t work, right?I can of course access :bar
by getting it directly from db, but the point is to use existing sub
I've only seen it done with an interceptor using a third party library
https://github.com/vimsical/re-frame-utils/blob/master/src/vimsical/re_frame/cofx/inject.cljc
https://github.com/Day8/re-frame/blob/master/docs/FAQs/UseASubscriptionInAnEventHandler.md
@ag sounds like you might be after the path
interceptor? Maybe.
But what if the sub I’m tapping into has a complex signal graph (a bunch of :<-
s are applied to it)
No it doesn't.
I'll mention it just in case. It doesn't inject subscriptions but it does narrow the value within app-db
which is supplied, like update-in
Search for path
in here to see it used and explained:
https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/events.cljs