This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # aleph (59)
- # beginners (21)
- # bigdata (1)
- # boot (110)
- # cider (7)
- # clara (1)
- # cljs-dev (160)
- # cljsjs (3)
- # clojars (10)
- # clojure (122)
- # clojure-czech (2)
- # clojure-dusseldorf (5)
- # clojure-france (1)
- # clojure-italy (4)
- # clojure-korea (5)
- # clojure-russia (13)
- # clojure-spec (15)
- # clojure-uk (78)
- # clojurebridge (1)
- # clojurescript (196)
- # core-async (6)
- # core-logic (27)
- # cursive (11)
- # data-science (2)
- # datomic (45)
- # dirac (9)
- # emacs (2)
- # funcool (8)
- # hoplon (16)
- # immutant (13)
- # jobs (1)
- # klipse (11)
- # lein-figwheel (1)
- # leiningen (1)
- # off-topic (3)
- # om (40)
- # onyx (31)
- # pedestal (25)
- # re-frame (55)
- # ring (1)
- # ring-swagger (1)
- # rum (4)
- # specter (1)
- # sql (2)
- # untangled (30)
- # vim (12)
- # yada (12)
> It looks like like 64 of subs.cljc is having the problem. That line looks like it is a comment to me
Regarding line 23 of your gist, I can see nothing wrong there. I suspect some surounding problem (unbalanced parens or something?) is misleading you. Nothing obvious.
@shaun-mahood Thanks for your time and example! I don’t really see how it gives me the ability to use the value of subscriptions as input to handlers though?
For something more substantial, there https://github.com/luminus-framework/luminus-template which has a
If there is a more general problem it does seem an odd place for it to initially show itself.
I removed all the changes to project.clj, cleaned the project and rebuilt (which I did like a thousand times) and now it’s working.
Something like this:
(defn subscription-stub [x] (atom (case x [:query-id] 42))) (deftest some-test (with-redefs [re-frame/subscribe (subscription-stub)] (testing "some rendering" ..... somehow call or render the component and check the output)))
@vikeri: Hmm, it might not solve exactly the right problem 🙂 What I was looking at was getting the app-db accessible to any of the subscriptions as you pass them through the different forms - essentially, you could re-make your calculations so that they all depend on app-db, and then the function can be declared somewhere outside of the subscription and used by any event handler or subscription.
@vikeri: Could you just dispatch an event from within your subscription? I've never tried it so have no idea if it's either possible or a good idea, but is that more along the lines of what you want?
@agold: I think if you separate it into the container component model that the react/redux community has endorsed I think it simplifies the testing.
You could optionally inject the component instead of calling it directly as I've illustrated in an article I posted previously: https://junctionbox.ca/2016/09/03/clojurescript-reagent-reframe.html
@shaun-mahood the app-db is available at a particular point in time with the reg-event-db.
@shyambalu: Sort of - https://github.com/Day8/re-frame/blob/master/CHANGES.md has the details of what changed, and the docs in https://github.com/Day8/re-frame/tree/master/docs are pretty up to date with info on how to use most of the new features. It's probably worth looking at the examples in https://github.com/Day8/re-frame/tree/master/examples as well. Outside of middleware (if you have any that you've written), everything else should run fine in 0.8 so you can implement the new features one at a time as you determine what changes you want to take advantage of. If you have any specific questions or problems, please post them here and hopefully we can help.
@nfisher: Yep! Not sure if you saw the rest of the discussion with vikeri above, but I was trying to figure out how to thread the DB values through the fancy new forms of
reg-sub - I've never used them before and was seeing how they work. I think I may have answered the wrong question though...
@nfisher: And please, continue to suggest things to me - I'm a committer on documentation only, and half of that is because I don't know what I'm doing so decided it was the best way to learn 🙂 I miss obvious things pretty often, as I've found a way to use re-frame that works for my projects but there's lots of other use cases and problems that I haven't encountered
I made the assumption I could just frame everything with the context provided in the dispatch
Wired up nicely when I did the PoC which was just shuffling data between screens but once I started doing calculations and such I started to find it a painful abstraction.
@nfisher: You aren't the only one to go down that path - it seems like a pretty common approach when starting out. It's gotten a lot nicer with the new
fx handlers, a lot of the places where I would have wired up a big, overly complex db-handler have turned into a bunch of nice
@nfisher: It took me quite a bit of work to really get a handle on them, but the nice thing is that you can gradually convert over to them as you decide what makes sense. Let me know if you have any specific questions once you start looking at them, happy to work through some code with you if you want. I've found that a lot of it is determining trade-offs and gradually refactoring until I get to something that feels right, but thankfully it's pretty easy to do.
@shaun-mahood thanks I started with ReactJS+Redux and started looking at CLJS based on recommendations from a few ppl I know.
@nfisher: That's awesome, you know good people 🙂 It's such a nice thing to be able to use Clojure everywhere.
I’m still trying to figure out a way to do server side rendering that reagent can pick-up once it’s loaded.
@nfisher: https://yogthos.net/posts/2015-11-24-Serverside-Reagent.html is the best resource I know for that - it's on my list for future experimentation, but I haven't tried it at all
There are excellent resources in both Om and Rum for that as well, if you ever decide to branch out and try either of them.
I figured by going down the container/component route the component could be used. Looks like @yogthos ran into somethings that I figured would be issues.
@nfisher: I found reagent more understandable than om as a beginner, but there are definitely trade offs in all of the react libraries - it just depends which things are more important for your use case. One of my favourite things about the whole community is the amount of cross pollination between the different libraries. As far as I know, the approach to server side rendering started with foam (a library for the original om), which inspired the implementation in rum, and then the server side implementation of rum got a bunch of optimization work that inspired some changes in hiccup, and now om.next has full server side rendering as part of it's core implementation. Such a cool thing to be able to watch in a community that is so friendly and excited about new ideas.