This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-20
Channels
- # announcements (2)
- # architecture (5)
- # beginners (118)
- # cider (5)
- # clara (13)
- # cljdoc (8)
- # cljs-dev (49)
- # cljsjs (2)
- # clojure (107)
- # clojure-dev (9)
- # clojure-europe (3)
- # clojure-italy (58)
- # clojure-japan (2)
- # clojure-nl (6)
- # clojure-spec (89)
- # clojure-uk (27)
- # clojurescript (9)
- # core-async (33)
- # cursive (2)
- # datascript (2)
- # datomic (31)
- # duct (4)
- # emacs (1)
- # events (1)
- # figwheel-main (1)
- # fulcro (69)
- # hoplon (7)
- # hyperfiddle (16)
- # incanter (4)
- # instaparse (4)
- # kaocha (1)
- # mount (2)
- # nrepl (19)
- # off-topic (40)
- # onyx (6)
- # other-languages (3)
- # pedestal (2)
- # re-frame (48)
- # reagent (2)
- # reitit (10)
- # ring-swagger (9)
- # shadow-cljs (63)
- # spacemacs (13)
- # sql (8)
@mikethompson Thanks!
Where can I learn about co-effects? In the context of re-frame and otherwise.
I found the description as "side-causes" quite illuminating too
I've got a view with two inputs, both of which use on-input
typing in one of them causes the whole area to be re-rendered, and I lose focus. the other one works fine.
Re-renders are triggered by subscriptions. Make sure each of your fields has a separate subscription for its own data, as opposed to having one subscription return the data for the whole form, and it should render each field separately.
If it doesn’t, and you can post some code, I could take a look at it.
When trying to combine re-frame and devcards, it only makes sense to use devcards for reagent components that are the domino 5 of re-frame, is that correct? Or is there something else I can use devcards for in this setup?
The re-frame-template uses defroute
inside a function (defn app-routes...)
. Why was it done that way? It seems unusual to me to def
anything inside a function.
defroute
is sliiightly misnamed, since it doesn't def
any vars in the Clojure sense.
@devurandom if i recall, it was a quirk of using secretary which uses macros to define the routes and the timing mattered
@braden.shepherdson But the secretary readme shows that the route can later be used as a function in that namespace...?
(defroute users-path "/users" []
(js/console.log "Users path"))
(users-path) ;; => "/users"
@gadfly361 I tried to remove the wrapping function and call defroute
in the global context, as well as secretary/set-config!
and hook-browser-navigation!
. And I ran into the issue that now the :active-panel
is not anymore set upon loading the application. I have to call (secretary/dispatch! js/window.location.hash)
(roughly, writing that from memory) during the "load" event on js/window
to make the application show the right content. Could that be the timing problem you mentioned?
And if secretary is behaving so unreliably, is there something better?
If I want to dispatch a fetch action when visiting a page, where do I call dispatch? I’m using the reitit router.
I stand corrected; I didn't know you could call a route like a function.
anyone with insight into my problems with a form, above?
Hi guys
If I would make a streaming service to show the updates coming from server to update the re-frame db, how can I make the client subscribe with for example Kafka channel which will have the output of streaming output
@gadfly361 In bide I would then (re-frame/dispatch [:active-panel :foobar])
within a case
or cond
statement on the route name and query parameters? Do you have an example?
so the should be as simple as possible, ui client "re-frame", Kafka to keep output of streaming, streaming service "which do processing and push to Kafka" how can I make the three parts connected together?
Anyone try this before or have advice on this?
Thanks in advance
@devurandom lein new re-frame foobar +gadfly
for an example ... that is a hidden profile and makes no promises to the user, but is uses bide as a router
@urzds yeah, re-frame does not currently play well with devcards. Although i seem to remember that people have found various hacks.
@mikethompson But I can use devcards for the limited use-case of playing with domino 5 in re-frame? Without those defcards (and thus e.g. reagent) ever getting in contact with the actual data that is stored by re-frame?
@abdullahibra I haven’t played with streaming to the browser myself, but I found this, maybe it would be helpful? https://github.com/larrychristensen/messenjer
@jayzawrotny the fetch action would normally be initiated by the logic that knows about the change in page, nt by the page itself (which is just a rendering of current state)
Gotcha. Sounds like I should be setting up an effect handler for the :navigate event the luminus app dispatches on init and nav actions.
Perhaps have a look in the example apps listed within https://github.com/Day8/re-frame/blob/master/docs/External-Resources.md
Also have a look at https://github.com/Day8/re-frame-http-fx
and this will help also https://github.com/Day8/re-frame/blob/master/docs/FAQs/LoadOnMount.md
Probably read that FAQ entry first
I actually read that FAQ entry which is what lead me to believe that I should be loading data as an effect instead of putting it in the view on an on-component-did-mount or similar lifecycle method.
Right now I’m grappling with events -> event handlers aspect. Currently a google history handler listens to the NAVIGATE event and dispatches a [:navigate route]
event. The :navigate route is then put into the db from a reg-event-db
call. So what I’m trying to find the answer to is if I should create an additional reg-event-fx
for :navigate to potentially dispatch a :fetch-page-data event or if I should be using one reg-event-fx that handles both updating the db and dispatching the subsequent fetch event.
I believe I have my :fetch-page-data event and handler setup but now I’m trying to learn how to connect :navigate -> both update the db and dispatch :fetch-page-data.
@manutter51 great thanks
@devurandom yes, correct. You can use reagent with devcards