This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-10
Channels
- # announcements (3)
- # beginners (67)
- # calva (4)
- # cider (3)
- # clj-kondo (58)
- # cljs-dev (4)
- # clojure (172)
- # clojure-berlin (4)
- # clojure-chicago (8)
- # clojure-europe (4)
- # clojure-greece (8)
- # clojure-italy (12)
- # clojure-nl (4)
- # clojure-spec (7)
- # clojure-uk (77)
- # clojurescript (13)
- # clojutre (16)
- # core-async (10)
- # cursive (3)
- # datomic (29)
- # figwheel-main (27)
- # fulcro (22)
- # garden (3)
- # jobs (2)
- # jobs-discuss (13)
- # juxt (5)
- # leiningen (14)
- # mount (4)
- # off-topic (28)
- # pathom (6)
- # pedestal (8)
- # portland-or (2)
- # re-frame (20)
- # remote-jobs (6)
- # shadow-cljs (13)
- # sql (74)
- # testing (17)
- # tools-deps (1)
- # vim (1)
- # xtdb (1)
hi, i need some expert view about how to apply time changes in a reagent project. now i am making an app to track orders. orders should be delivered in 30 minutes. and in my view I am listing orders and remaining minutes. so every minute render must be updated. my idea is updating DB every order, every second, so in if there are 60 orders waiting 60 minutes 216.000 rendering operation will occur. it doesn't feel like correct approach. but is it ?
I would dispatch
something like [:check-order-times]
that updates some relevant flags in the DB for the orders taking the time into account. The event handler would find the next time when it needs to update some properties given all of the times and would :dispatch-later
itself given the required delay.
Oh maybe I misunderstood you, given your edit. In this case, don't run N updates (N is the number of orders). Just run 1 update with N operations in it every second.
thank you i didn't know dispatch-later exist. btw are there side effect to update the db very often?
Well, the subscriptions will be re-evaluated. Make sure you use layer 3 subscriptions where appropriate to not redo costly computations that don't change their value: https://github.com/Day8/re-frame/blob/master/docs/SubscriptionInfographic.md#the-layers
Hi, I have question regarding effects/coeffects. My application’s log-in flow is: 1. user submits credentials -> 2. server responds -> 3. app updates db and dispatch an effect to change the page. For step 3, I have an event handler to do this. My question is on step 1 and 2. The action seems to be both an effect and a coeffect. I’m making a effect to the server, yet the response from the server is a coeffect to my step 3. What do you suggest to implement this flow?
Have you seen https://github.com/Day8/re-frame-http-fx ?
Thanks, I just did! Now I see the :on-success and :on-failure handlers. It makes a lot of sense.
To answer my own question, I guess it’s unnecessary to think of injecting arguments with coeffects. A chain of event-fx handlers to pass down results should be just fine.
Hey All. I have just moved from lein to deps.edn. The app is happy and working, however, re-frame 10x is no longer working. I think it's because I am not properly specifying the closure-defines
and preloads
inside of my dev.cljs.edn
. Can anyone give guidance here?
{:dev
{...
:extra-deps
{...
day8.re-frame/tracing-stubs {:mvn/version "0.5.1"}
day8.re-frame/re-frame-10x {:mvn/version "0.3.3"}
}}}
;; dev.cljs.edn
{:main ...
:extra-preloads [day8.re-frame-10x.preload]
:extra-closure-defines {"re_frame.trace.trace_enabled_QMARK_" true
"day8.re_frame.tracing.trace_enabled_QMARK_" true}}
Ah, it must be Figwheel, right? I have moved to deps.edn
as well, only I've also switched from Figwheel to Shadow-CLJS. Works quite good, for what it's worth.
Judging by https://github.com/bhauman/figwheel-main/blob/master/doc/figwheel-main-options.md all of the flags apart from :main
must be entered as metadata.
what happens if you say just :preloads
and :closure-defines
? Otherwise it looks like it ought to work
here’s a dev.cljs.edn for figwheel-main and re-frame-10x that works for us: https://gist.github.com/rgm/a099f297ae128f2dbd507319d3d50b60