This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-11
Channels
- # aws (6)
- # beginners (105)
- # boot (6)
- # cider (50)
- # cljsrn (10)
- # clojure (41)
- # clojure-brasil (6)
- # clojure-italy (25)
- # clojure-nl (17)
- # clojure-russia (4)
- # clojure-serbia (1)
- # clojure-spec (8)
- # clojure-uk (242)
- # clojurescript (27)
- # core-async (10)
- # cursive (5)
- # data-science (9)
- # datomic (43)
- # emacs (6)
- # fulcro (6)
- # graphql (1)
- # javascript (3)
- # juxt (4)
- # lein-figwheel (1)
- # mount (1)
- # onyx (19)
- # parinfer (2)
- # portkey (15)
- # protorepl (1)
- # re-frame (30)
- # reagent (3)
- # ring-swagger (1)
- # shadow-cljs (22)
- # sql (6)
- # tools-deps (23)
- # vim (13)
Are there any recommendations for working with async API's as coeffects? Specific use case is where an event handler needs data which lives behind an async api.
I think the correct but clunky approach is to make sure the data is in app-db before the event handler is called.
Incidentally @mikethompson it seems to me Statecharts would provide a good way to know what transitions are allowed to occur. That would provide a logical place to do data preparation actions before they run.
@olivergeorge async APIs are probably similar to HTTP APIs like https://github.com/Day8/re-frame-http-fx
No wait. I take it back. You said coeffects
(not effects
)
Are we talking about promises?
Yes. In particular I was looking at react native AsyncStorage which returns promises
Question is how to live with lazy data sources like that.
A state machine approach works (do this, when it's done do that)
but it's cluttering
Would be nice if coeffect promises worked without extra code/events.
As a separate point. It'd be nicer if it wasn't left till the last second to do since those little delays could affect the user experience.
e.g. load the data early and it's ready when you need it
@mikethompson 3–4ms sounds suspiciously like on the next frame when running 60fps
@tomi.hukkalainen_slac 60fps implies 16ms, I think? No it is more this ... http://www.chrisdanford.com/blog/2013/08/10/how-settimeouts-timer-clamping-works/
Hmm. But there is a comment about that being wrong
I do know I appeared to be bitten by this when using core.async
and asking for a timeout
of 0
but getting instead 4ms
.
(core.async uses a timer underneath)
Hi, I am using the re-com typeahead field and I have trouble when editing an existing value. This is my shortened code:
(let [file-to-edit (<sub [::fsub/file-to-edit])
id (:id file-to-edit)]
[:div
[ta/typeahead :data-source filter-file-type :class "ten-top-bot dummy-type-class" :attr {:id "type"}
:on-change #(>evt [::fev/edit-file id :type %]) :model (:type file-to-edit)]
]]))
The problem is, a change in the typeahead field will update the type vaule of the file, as expected, but then the dropdown is not visible anymore.
It does work if I dont set the :model
key initially. But I loose to display the current type of the value then.Do we have some guarantees on order of events-handlers, for example, when we use :dispatch-n
? I have
{:dispatch-n (list [:put-a] [:read-a])}
where I put a
into db, then want to read itI think this explains it a bit: https://github.com/Day8/re-frame/blob/master/docs/Effects.md#order-of-effects
that’s not quite my usecase. And here’s https://github.com/Day8/re-frame/issues/465 - which means there is some ordering happening, but, alas, not quite my case too. So I think I’ll just go an empirical way
events are processed in the order they are dispatched.
dispatch-n
dispatches events in the order provided
[put-a]
would be processed completely first
then [:read-a]
would be processed completely