This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-27
Channels
- # aleph (7)
- # beginners (80)
- # boot (1)
- # cider (3)
- # cljs-dev (277)
- # cljsjs (52)
- # cljsrn (1)
- # clojure (69)
- # clojure-gamedev (4)
- # clojure-italy (1)
- # clojure-losangeles (2)
- # clojure-russia (89)
- # clojure-spec (92)
- # clojure-uk (196)
- # clojured (1)
- # clojurescript (70)
- # cursive (5)
- # data-science (1)
- # datascript (84)
- # datomic (9)
- # defnpodcast (12)
- # docker (1)
- # emacs (4)
- # events (1)
- # fulcro (112)
- # graphql (1)
- # jobs (1)
- # lumo (1)
- # nrepl (21)
- # off-topic (2)
- # onyx (3)
- # protorepl (10)
- # re-frame (23)
- # reagent (66)
- # reitit (2)
- # rum (13)
- # shadow-cljs (144)
- # spacemacs (14)
- # sql (4)
- # unrepl (29)
- # vim (16)
We are building a wep app with re-frame and trying to refactor some of our events. Each time something is changed, The app-db is updated, the remote db is updated (http request) and pusher is updated (websocket). Managing all three is getting a little out of hand. We are considering using interceptors with some business logic events. A change is made -> Business logic event dispatched -> decide whether or not we are happy with the change -> dispatch 2nd business logic event with 3 attached interceptors. (Update app-db, remote-db & pusher). Just wanted to get others thoughts on this approach, and see what other people have done in similar situations
I could also imagine doing something similar as an fx, where you put all of the logic in the fx handler. I think either way would work ok though?
We have our http requests and pusher events set up as fx, although a fair few parameters in the fx are repeated. So we end up with 2 events which return fx (to keep it DRY) & our primary event will dispatch-n the three events
We like the idea of being able to “bolt on/attach” functionality to our event easily with interceptors, without needing to worry too much what effects are happening within the handler itself. Our handlers would be primarily business logic
Alright well if that doesn’t sound crazy I’ll give it ago and see if makes things easier. Cheers
Using lein re-frame template.
lein new re-frame npuzzle +10x +garden +test +cider
Then I deply to heroku as per instructions here: https://github.com/Day8/re-frame-template#production-build
I get these errors in app log in heroku:
2018-02-27T03:28:46.620804+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2018-02-27T03:28:46.626435+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -Dfile.encoding=UTF-8
2018-02-27T03:28:52.373794+00:00 app[web.1]: No :main namespace specified in project.clj.
2018-02-27T03:28:52.374621+00:00 app[web.1]: Error encountered performing task 'trampoline' with profile(s): 'production'
2018-02-27T03:28:52.374755+00:00 app[web.1]: No :main namespace specified in project.clj.
What is the main namespace asked for here? I’m quite new to clojure, google didn’t help here.@duminda can you create an issue please, we'll deal with it that way
an issue in re-frame-template
repo
@duminda You need to add the +handler
profile to be able to deploy to heroku CC @mikethompson
@gadfly361: Works!
@gadfly361 a bit offtopic, but how can I defer rendering Rid3 charts only after component has finished mounting
@dimovich Event names should capture user intent. You can find some idiomatic events in the todomvc example in the re-frame repo: https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/events.cljs
@dimovich hmm, you could create a placeholder div that is the same dimensions as your rid3 component that is displayed on page load and then replace it with your rid3 component as a result of some event that is dispatched on a did-mount life cycle event for the page component
@dimovich I agree with @curlyfry, I think there's some docs somewhere that covers this, but I couldn't find them quickly
But it's a common question, and a reasonable one to ask
@gadfly361 works fine this way. thanks!