This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-17
Channels
- # adventofcode (76)
- # announcements (6)
- # beginners (103)
- # boot (28)
- # calva (128)
- # cider (48)
- # cljs-dev (40)
- # clojure (268)
- # clojure-austin (2)
- # clojure-dev (2)
- # clojure-europe (47)
- # clojure-italy (10)
- # clojure-nl (17)
- # clojure-spec (2)
- # clojure-uk (15)
- # clojurescript (45)
- # code-reviews (14)
- # cursive (5)
- # data-science (2)
- # datascript (1)
- # datomic (52)
- # duct (4)
- # emacs (2)
- # figwheel (1)
- # figwheel-main (4)
- # fulcro (13)
- # hyperfiddle (51)
- # leiningen (19)
- # nrepl (40)
- # off-topic (45)
- # pathom (3)
- # pedestal (28)
- # portkey (7)
- # re-frame (25)
- # reagent (76)
- # reitit (7)
- # shadow-cljs (92)
- # slack-help (3)
- # specter (5)
- # timbre (2)
- # tools-deps (39)
- # unrepl (1)
- # vim (13)
@bob592 i think you would find this article useful: https://pupeno.com/2015/08/26/no-hashes-bidirectional-routing-in-re-frame-with-bidi-and-pushy/
It works like a charm, you kinda just need to make sure the server will return index.html for everything that is’nt a resource/file on the server
js/setInterval
on did-mount, and teardown on will-unmount?
This is how i usually do it, not re-frame specific.
i am doing that, actually i should have asked if you guys use some standard effect for that
I do this:
(reg-event-fx
:timer/start
(fn [cofx [_ opts]]
(let [{:keys [db]} cofx
{:keys [interval-ms on-tick id]} opts]
{:db (assoc-in db [:timers id] (assoc opts :status :started))
:dispatch-later [{:ms interval-ms :dispatch [:timer/tick id]}]})))
(reg-event-fx
:timer/tick
(fn [cofx [_ id]]
(let [{:keys [db]} cofx
{:keys [interval-ms on-tick id status]} (get-in db [:timers id])]
(when (= status :started)
{:dispatch on-tick
:dispatch-later [{:ms interval-ms :dispatch [:timer/tick id]}]}))))
(reg-event-db
:timer/stop
(fn [db [_ id]]
(update-in db [:timers id] assoc :status :stopped)))
Probably not as good as setInterval though
@mateus.pimentel.w I'm using Pedestal on the back end and could use some guidance for the following goal: I want "/" to go to a static landing page with a different CSS style altogether than the portal at "/admin" that the user logs into through "/admin/login". Since re-frame apps mount a div by ID, I don't seem to have the control I want over the HTML document as a whole. When I slurp a different index.html for admin at "/admin" in my Pedestal routes configuration, Bidi always gives me the "page not found" view (see re-frame-starter at github). even though I defined the route as ["\" {"admin" :homepage ...}]. Anything under that, goes through Pedestal's routing. bidi can't seem to handle not being off "/" as the starting point for the SPA, or I just don't know how to make it work right with Pedestal for my specific needs. In any case, if I can find some way instead to support multiple page designs, I would be happy with one SPA for the front and back ends, and Bidi would probably work with that. Can re-frame/reagent take over the whole document, or must I always mount a named div?
Where can I rent a re-frame expert for an hour or two? Berlin would be nice, but anywhere really is fine.
@mateus.pimentel.w OK i'll look into that.
@bob592 that article i sent you is like an walkthrough, i think you will have success following it
I want to make a layer-3 subscription with two inputs, but that only updates when one of those inputs is changed.
I suppose there's some way to make that work properly with reg-sub-raw
.
What’s a nice way to prevent the app-db being completely reset when a user refreshes the page?
you can fairly seamlessly persist all or parts of the app-db to and from localstorage, for example.
@mikethompson have you dug into how re-frame’s dispatch queue fits in with React’s new async rendering / “Concurrent Mode”?