@joservarelaf Holy cow! I’m glad I grabbed a screenshot of your comments an hour ago in that thread, because it’s gone now, due to Slack free tier limits! 🙂 WHEW!
@regen WOW!!! Thank you! That’s awesome!!!
…and a relief!!!
Lol no way wait
Had it saved, pressed back and took screenshots haha I think we’re on to something here I’m down to hack on this during the weekend
ta-da https://www.dropbox.com/sh/ln611endzm2v8g0/AABMKZknxOHbqgAej_Rj1RSma?dl=0
Thank you!! And you can find the thread here, too, on the Clojurians Slack archive: https://clojurians-log.clojureverse.org/re-frame/2020-07-26
oh wow I wasnt aware this existed
Hi, @mikethompson — I had a great time prototyping a program that assembled an event dispatch graph from an events.cljs file, to help me make sense of a sprawling call graph that built up over 4.5 years!
I wrote up an experience report here: https://docs.google.com/presentation/d/1yf6f7OYFWYADZ59nrSSNWjiw8zf-yt60yBjWqrJFPdA/edit#slide=id.p
Mike, there’s a question directed to you at the end — can you point me to where in re-frame-10x
I might find the event log, from which I could render a similar graph, or any advice?
For y’all’s amusement, here’s my dispatch graph, with 107 nodes, 69+ edges (incomplete) — guess which part involves UI with multiple modes? 🙂 (Answer is in the Google Slides deck linked above.)
As a tip, you can find threads you've participated in near the top of the left sidebar in Slack. They seem to stay there for quite a while!
Ha thanks! @regen learned something new today
@genekim Thanks, I just had a quick skim ... I'll have a proper read later As I skimmed, I got a little struck by slide 12 ... Slide 21 could be done with this
(reg-event-fx
::edit-car-key-down
[check-spec-interceptor]
(fn [_ [_ {:keys [keycode]}]]
(if (= 27 keycode)
{:dispatch [::cancel-card-name]}
{}))
Notes:
1. You don't have to return a :db
effect in a reg-event-fx
2. Instead of having the view dispatch ::edit-car-key-down
it almost seems as it should be the one emitting a
::cancel-card-name`. Events should model user intent. The nil return path is a dead giveaway
Also on slide 11 can be done like this:
:dispatch-n [[::first-one :blah :foo]
(when (not= blah) [:next-card])]
Notes:
1. when
is friend when you want nil
on else
2. :dispatch-n
will ignore nil
Overall Notes: 1. it looks as though you have one event emitting other events as a way of not simply calling a function (but I'm not 100% on that ... will have to read more) 2. it looks as if you might need a broader state-machine to manage the "higher level' dynamics (you say that you can't keep "the overall flow" in your head)
🙏🙏🙏 Thanks so much for the critiques!!! And OMG. I feel like a truly terrible person as you typed my (bad) code in from a screenshot. 😱😱😱. Sorry!! PS: for you convenience, here’s the source. (Was listed on slide 2 or so, I think) And i apologize for the embarrassments you’ll find in there. Like a caveman playing a grand piano. 😂😂😂
I have to say your use of guardrails and check-and-throw
impresses me. In my code those things are nonexistent 😹
Haha — your ability to write and run code without Guardrails and check-and-throw
impresses me! Seriously, I pass in wrong stuff all the time, sometimes as an accident or misinterpreting the API.
(Just yesterday in my first reg-fx
posted above, at first I accidentally passed in [board-id]
instead of board-id
and would have spent 10+ minutes trying to figure out why I was getting strange behavior or unreadable, long exception.)
I am able to now, but maybe not when touching it again next year. 😅 I do see real value in type signatures as documentation, and wish it was more common to use them in Clojure!
https://github.com/realgenekim/re-frame-event-graph/blob/master/resources/trello-events.cljs Posted only for your convenience! And thanks again!!!
@mikethompson Your observation about using a state machine(s) is jolting. I can totally see adding one function could take most of the logic out of many of the events. Exciting!
@genekim This is all good. I like seeing how people use re-frame. I'll cycle back later today - morning meetings here
Cool cool. For your amusement, I’ll post a video of the app tomorrow, and maybe I’ll use this as incentive to get all the Trello secrets out of the repo, and publish it. (Something I’ve wanted to do for 4 years. 🙂 (Although it will show everyone to what extent I don’t understand CSS. :rolling_on_the_floor_laughing::rolling_on_the_floor_laughing: