Fork me on GitHub
#re-frame
<
2018-07-20
>
mikethompson00:07:14

@ghopper we put a lot of effort into re-frame-10x, so that burned most of the "open source budget" we had available across the last 8 months. But yeah, we'll get around to that stuff in the next 6 months.

mikethompson00:07:48

I'm kinda interested in doing what's necessary to get re-frame into a better position for doing state machine based UIs.

ā¤ļø 4
šŸ‘ 4
mikethompson00:07:01

That, to me, is the next interesting frontier

mikethompson00:07:01

/docs/EPs is where all thinking goes when there's time

mikethompson00:07:11

But we'll "promote" stuff from EP stage to real Github issue for general comment when there's enough maturity

Garrett Hopper00:07:40

@mikethompson Thanks for the update. The 10x stuff is super cool, and I'm very interested in the state machine UI stuff. Thanks for clarifying the EP stuff as well.

kennytilton07:07:43

State machines rock. This a weird one: https://codepen.io/kennytilton/pen/aGJxMm?editors=0010 JS to make CodePen happy. It simulates an asynchronous chip circuit by having an FSM for each wire. The weird thing is that the only input to the FSMs is the tick of a clock.

lepistane08:07:23

why am i gettin re-frame: no :event handler registered for:

cljs.core.Keyword {ns: null, name: "initialize-db", fqn: "initialize-db", _hash: 230998432, cljs$lang$protocol_mask$partition0$: 2153775105, ā€¦}
cljs$lang$protocol_mask$partition0$
:
2153775105
cljs$lang$protocol_mask$partition1$
:
4096
fqn
:
"initialize-db"
name
:
"initialize-db"
ns
:
null
_hash
:
230998432
__proto__
:
Object
(ns bus-routes.db)

(def default-db
  {:page :route
   :coord nil})
and
(ns bus-routes.events
  (:require [re-frame.core :refer [dispatch reg-event-db reg-sub]]
            [bus-routes.db :as db]))

;;dispatchers
(reg-event-db
 :initialize-db
 (fn [_ _]
   db/default-db))

lepistane08:07:19

calling

(defn init! []
  (rf/dispatch-sync [:initialize-db])
...

lepistane09:07:00

always eval new subs/events

manutter5111:07:08

Are you sure your bus-routes.events ns is getting required by the ns that calls init!?

lepistane11:07:13

i expected figwheel to load that on save but it didnt once i eval-ed ns - it worked

lwhorton14:07:22

the tooling for reframe is getting pretty badass. i just got 10x working and big kudos to the team there. i just need to figure out a way to make the epoch replay work with a halted async-flow fx ā€¦

šŸ‘ 4
Drew Verlee00:07:33

Check out state charts for re frame then. I'm very curious why the idea isn't more popular

Aaron15:07:28

Hey all, I have a structured DB like this:

[:devices [:docs [:data ["assignedDate" "1992", "owned" "FALSE", ...]
I am having trouble figuring out the right way to build my reg-event-db so that I can update the "owned" field... Here is my function:
(re-frame/reg-event-db
 ::owned-updatedb
 (fn [db [_ owned-val]]
   (update db :devices assoc :owned owned-val)))

Aaron15:07:36

I know this is simple, but that is my noob level

guy15:07:30

Why not have a different shaped DB? For example a map?

Aaron15:07:51

This DB is pulled in from Firestore, so not sure how I would do that

guy15:07:24

{:devices {:docs {:data {"assignedDate" "1992"
                         "owned" "FALSE"}}}}

guy15:07:37

Well you could just convert ur vector into something else i guess?

guy16:07:11

How do you get ur data?

guy16:07:17

As a JSON or something?

Aaron16:07:35

Yes I believ eJSON

guy16:07:59

So you could use data.json to take ur json and turn it into a map for u

guy16:07:11

(json/read-str "{\"a\":1,\"b\":2}"
               :key-fn keyword)

guy16:07:20

would produce {:a 1 :b 2}

guy16:07:22

i believe

guy16:07:39

i gotta go but ill check this slack in like an hour

Aaron16:07:04

Ok thanks. I'm going to keep going through this https://github.com/deg/re-frame-firebase before Itry a new idea

Aaron16:07:07

Thank you

Aaron17:07:24

@guy figured it out, I needed to use update-in to find the entry

guy18:07:38

ok nice one @aaron993 !

Bravi18:07:43

hi everyone. I have a scroll event listener, that saves the scrollTop in app state. and then I have a few sticky components, that use this subscription. Iā€™m using rf/dispatch to save the scrollTop in state. and whenever I do this, and when I scroll the page up and down, those sticky components are a sort of jiggling a bit

Bravi18:07:13

and if I change rf/dispatch to rf/dispatch-sync, then it works fine (it becomes proper smooth). and I was wondering why is this happening? is there an explanation to this?