Fork me on GitHub

@pupeno we use cljs (and re-frame) within electron


We find it fairly painless ... in the main it is just like targetting Chrome


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


@mikethompson unbalanced paranthesis would stop compilation. That’s not it.


@mikethompson did you use a template to get started?


@pupeno I sometimes use a template to start a project, yes


Typically re-frame-template


For something more substantial, there which has a +re-frame option


@mikethompson oh, I started from descjop, for electron integration.


I think you are right in that it is a surrounding problem, but it’s subtle.


I looked fairly carefully at your gist and couldn't see a problem


Yeah, it’s probably not there.


If there is a more general problem it does seem an odd place for it to initially show itself.


It looks like there’s a problem with the ratom.


Let me show you...


holly cow… now it’s working.


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.


Oh well… moving on.


how do you test a function which fetch a value using subscribe ?


Something like this:

(defn subscription-stub [x]
    (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)))


is there a migration guide for going to 0.8


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


The component becomes a pure function and the container maintains the subscriptions.


You could optionally inject the component instead of calling it directly as I've illustrated in an article I posted previously:


@shaun-mahood the app-db is available at a particular point in time with the reg-event-db.


@shyambalu: Sort of - has the details of what changed, and the docs in 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 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


@shaun-mahood think I mixed some of the convos. Soz


Yes I started on a project doing one big handler and found it unwieldy.


I made the assumption I could just frame everything with the context provided in the dispatch


But it got messy quick.


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 fx handlers.


Will need to look at them.


I’ve just been using subs and events


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


I was already using Clojure hadn’t picked up CLJS/re-frame/etc.


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


Want to try and do graceful degradation/progressive enhancement


@nfisher: 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.


re-agent was suggested over om from a few ppl.


I’ll take a look when I have some time.


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


Oh cool 🙂