This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-13
Channels
- # beginners (50)
- # boot (27)
- # bristol-clojurians (7)
- # cider (30)
- # clara (1)
- # cljs-dev (130)
- # cljsrn (14)
- # clojure (179)
- # clojure-austin (6)
- # clojure-greece (2)
- # clojure-italy (4)
- # clojure-spec (19)
- # clojure-uk (54)
- # clojurescript (64)
- # core-async (3)
- # data-science (1)
- # datomic (66)
- # duct (11)
- # emacs (5)
- # figwheel (1)
- # fulcro (26)
- # funcool (7)
- # jobs (1)
- # jvm (6)
- # keechma (5)
- # lein-figwheel (5)
- # luminus (5)
- # lumo (1)
- # off-topic (93)
- # parinfer (37)
- # pedestal (15)
- # protorepl (10)
- # re-frame (42)
- # reagent (12)
- # shadow-cljs (71)
- # spacemacs (3)
- # specter (7)
- # vim (8)
- # yada (9)
@seako, what would it be promising?
And the promise is fulfilled when the event is handled?
i used this sort of hybrid event/promise style in the past with https://github.com/gaearon/redux-thunk
What is using the promise? Another dispatching event or the view?
There is re-frame-async-flow-fx as another take on this
i use async-flow-fx and like it for composing events together but i dislike that i find myself writing a lot of book-keeping type events that serve only to signal to the flow that something finished
which is to say that my do-thing thing-success thing-fail thing-complete events all make me feel like i'm very verbosely going through the process of writing my own artisanal promise in data
right, I understand what you're saying
My re-frame + re-com app works fine with :simple optimization but :advanced fails. Can’t see any errors or missing externs. Advice on debugging?
@agold what do you mean by "fails"?
The app stops responding to clicks on a button and an svg element with a click handler.
Correction. With :advanced optimizations, I get this error when clicking on button: Uncaught Error: No print-fn fn set for evaluation environment
Setting google.DEBUG true in project.clj seems to have fixed this, so :advanced optimization now works. But false was produced by template. I have no print stmts in my code.
Problem is this: clicking dropdown arrow prints following error to console: render false {:loading? false, :error nil, :choices [], :id 0, :timer nil} But choices vector-of-maps is defined, and choices render correctly. There is no :id 0. So not sure why this is happening.
There's really not enough information in there to be able to tell what's going on sorry, can you try maybe with a video showing the page + console?
http://agmardor.com/public/index.html Open the console and click the dropdown box labeled “Clock Multiplier"
Ok, I can see nothing happens, but that doesn't mean anything to me
After clicking start/stop that dropdown works
It works for me without clicking start/stop, but only because I’ve enabled console printing. The re-frame + re-com template normally disables printing for the build with advanced optimization (by setting goog.DEBUG to false). When that happens, the dropdown doesn’t work because clicking it tries to print something to the console, which throws an exception. Anyway, thanks for your help. I will either figure it out or leave console printing enabled in the optimized version.
@seako open an issue describing your use case, not sure if it would be part of dispatch
, but I know the issue you're talking about
Hi, Is there is a way to add/replace interceptors for an event after/before it has been defined?
In theory, it is possible for one interceptor to add remove further interceptors dynamically, at the time of execution.
In practice, with re-frame, I'm not sure all the necessary API is in place, but it is ABSOLUTELY a feature of interceptor arrangements.
You see, each interceptor's before
fn
is given a context
And context
contains the list of interceptors.
So any interceptor can alter the set of future interceptors (by alterting what's in the context they were given, and which they return )
So I'm answering this in two ways: 1. yes, in theory 2. in practice we may need to flesh out the available API / docs to make it possible/clearer
Thanks, @U051MTYAB. I am looking to monkey patch a library. Thought adding interceptors is much better than redefining one of its events entirely. But as you suggested, I can add a default interceptor which can look for dynamically defined interceptors and chain them into the context.
Hi, a query related to reg-event-fx macro. I want to dispatch multiple events from a handler, but couldn’t get it working. I want something like this:
(rf/reg-event-fx
:create-data-channel
(fn [{:keys [db]} _]
{:db (assoc db :initiator? false)
:dispatch [[:create-offer]
[:open-channel]]})))
You want :dispatch-n
instead of :dispatch
there
@manutter51 ah, cool. Thanks 🙂 It worked
When an :optimizations :advanced build doesn’t work completely, it would get no data from a graphql andpoint, and a :optimizations :simple does. What would be the way to figure out what’s going wrong with the advanced one? I suspect some strings which should’t be renamed do get renamed. Could it be because I referred to some events like
:open-bank.events/remove-transactions
?@gklijs Don’t you always refer to events by their keyword name? Those shouldn’t be a problem for advanced optimization. I may not understand your question well enough though.
You can do some debugging of advanced optimizations in general though via the :pseudo-names true
cljs compiler options.
Also, I believe one thing that closure advanced optimization never changes are strings (your example is a keyword though). So again, I think I’m a bit confused by your question.
I never really ran into the problem before, I don't know where to look. It might be a problem in re-graph. It's weird because the data just doesn't come in.
Yeah, it could be a bit hard to figure out when you don’t have any errors to go from. If you sort of have isolated the place in the code where you are passing “inputs” and getting back the “output” that you are thinking has a problem though, you could add some js console print sort of things around it to try to see what is going on with advanced optimizations. Also, if you knew parts of the code you wouldn’t expect to have names changed on, you can do a search for that in the advanced optimization compiled js file and see what it looks like.