Fork me on GitHub
#re-frame
<
2019-01-22
>
eraserhd15:01:47

Is it possible to use re-frame without react, and in Clojure (not cljs)?

aisamu17:01:39

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.)

WhoNeedszZz20:01:33

SImple answer: no.

eraserhd15:01:05

I have a curses-ui use case, maybe.

lilactown16:01:28

well, re-frame does depend on reagent for it’s reactivity.

lilactown16:01:41

but re-frame itself is CLJC

lilactown16:01:26

you’ll need to come up with your own way of subscribing and propagating updates to parts of your app

lilactown16:01:23

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

eraserhd16:01:33

You mean, like the ratom stuff? That's what I'm hoping to use from re-frame.

lilactown16:01:42

yes, like the ratom stuff

lilactown16:01:58

the ratom stuff all comes from reagent

lilactown16:01:30

and reagent is cljs-only

danielglauser19:01:48

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)

danielglauser19:01:45

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"]

danielglauser19:01:14

:profiles :dev :dependencies contains [day8.re-frame/re-frame-10x "0.3.4-react16"]

manutter5119:01:35

Can you try lein deps :tree and see what it recommends? (Assuming you’re using lein)

manutter5119:01:48

sounds like a version mismatch somewhere

danielglauser19:01:51

:cljsbuild :builds :compiler contains :optimizations :none and :closure-defines {"re_frame.trace.trace_enabled_QMARK_" true goog.DEBUG true}

danielglauser19:01:08

@manutter51 Will do

danielglauser19:01:37

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.

danielglauser19:01:03

Seems like lein should be pulling that dependency since it’s mentioned in the :plugins for re-frame-10x.

manutter5119:01:04

Do you have any recommended exclusions for reagent or re-frame?

manutter5119:01:23

Also, are you sure you need to include [cljsjs/react "16.4.1-0"]? We’re not using that in our re-frame project

danielglauser19:01:30

I’m not sure if we need to use that version, happy to try and different one. What version do you use?

manutter5119:01:55

We don’t have a reference to react at all, we just let re-frame/reagent pull in what they need.

manutter5119:01:58

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]]]

danielglauser19:01:06

I tried removing the [cljsjs/react "16.4.1-0"] dep, still fails in the same way. Upgraded Leiningen too.

danielglauser19:01:19

I’ll try matching your exact versions to see if that solves it.

danielglauser19:01:48

That worked! Thanks @manutter51. There must have been some type of version mismatch issue.

danielglauser19:01:40

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.

danielglauser19:01:14

Figured it out from the CHANGELOG

danielglauser19:01:48

[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.

danielglauser19:01:51

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.

tomayerst19:01:57

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"]]`

tomayerst19:01:30

No errors showing but ctrl-h doesn't bring up the console.

tomayerst19:01:51

(it is still ctrh-h on a MAc is it not?

tomayerst19:01:01

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"

tomayerst19:01:49

dropping to [day8.re-frame/re-frame-10x "0.3.3-react16"] fixed it

danielglauser19:01:31

That’s the same issue I was seeing @tomayerst. If you use 0.3.6 you shouldn’t see that error.

tomayerst19:01:49

Yeah, just read back and trying that now

tomayerst19:01:38

sweet! [day8.re-frame/re-frame-10x "0.3.3-react16"] works. Right, back to @ericnormand and "Understanding Re-frame" 😀

danielglauser19:01:38

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.

tomayerst19:01:54

Yeah, lovin' his stuff. I like it that you watch the thinking going on (and that its clear and well explained too!)

WhoNeedszZz20:01:03

As mentioned you should be using 0.3.6, not going backwards.

ericnormand21:01:27

right back at you, @U086KE6TX!

ag22:01:16

Can someone refresh my memory. There was a way to pull a sub value in an event-fx, right? Similar to :<- syntax for subs

ag22:01:07

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?

ag22:01:42

I can of course access :bar by getting it directly from db, but the point is to use existing sub

caleb.macdonaldblack22:01:39

I've only seen it done with an interceptor using a third party library

ag22:01:13

yeah.. that’s I think what I was looking for… Thanks!

mikethompson23:01:27

@ag sounds like you might be after the path interceptor? Maybe.

ag00:01:49

But what if the sub I’m tapping into has a complex signal graph (a bunch of :<-s are applied to it)

ag00:01:12

Path interceptor doesn’t take a subscription key, does it?

mikethompson03:01:54

No it doesn't.

mikethompson23:01:05

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

cryan23:01:56

hi everyone. i'm using re-frame and figwheel. when i change any component's render method, it seems like every component gets re-mounted (via figwheel calling my reload fn, which just renders base component). is that expected?

cryan16:01:02

oh, to answer myself, incase anyone else runs into this. the answer is yes it's expected haha.