re-frame

https://github.com/Day8/re-frame/blob/master/docs/README.md https://github.com/Day8/re-frame/blob/master/docs/External-Resources.md
genekim 2020-08-04T07:07:15.166900Z

For y’all’s consideration and comment — I wrote up how this graph helped me get something done. If y’all think it’s solid enough, I’d love to post to this channel and @ mention Mike Thompson.

genekim 2020-08-04T07:07:24.167100Z

Many thanks in advance!

genekim 2020-08-04T18:42:44.167800Z

Ooops! Forgot to post the link!!! https://docs.google.com/presentation/d/1yf6f7OYFWYADZ59nrSSNWjiw8zf-yt60yBjWqrJFPdA/edit#slide=id.p

Jose Varela 2020-08-04T18:48:27.168Z

Nice!

Jose Varela 2020-08-04T18:50:32.168200Z

@genekim in this case, what did you end up doing with the output? Did you rearrange some of these relations?

Jose Varela 2020-08-04T18:54:36.168400Z

Got it, “Countermeasure” explains what you ended up doing

genekim 2020-08-04T19:00:37.168900Z

Great catch — new title. :)

genekim 2020-08-04T19:03:02.169500Z

Thx @joservarelaf !

1👍
Jose Varela 2020-08-04T19:07:59.169800Z

It’d be awesome to show a chart like that and highlight the bubbles as the events are ocurring. Imagine running your app at ‘slow speed’ and seeing the event flow go through the graph.

1➕
Jose Varela 2020-08-04T19:08:54.170Z

Or a debugger step-through.. click, click, click and the graph moves

genekim 2020-08-04T19:29:54.170200Z

That blows my mind — that’d be amazing! (Maybe motivation to get a wrapper around MermaidJS… could dynamically render the graph…)

genekim 2020-08-04T19:30:27.170400Z

@joservarelaf Just added screenshot of your idea to the deck. 🙂

Jose Varela 2020-08-04T19:31:14.170600Z

haha thanks! what’s this deck are you giving a talk?

Jose Varela 2020-08-04T19:31:28.170800Z

hmmm maybe this is a great excuse for me to get started with clojure

genekim 2020-08-04T19:32:12.171Z

Oh, just the Google Slides you already saw — no intent to present it. It’s just easier to write in bullet points than actual full prose. 🙂 (PowerPoint/Slides is the tool for the lazy, which isn’t always a bad thing — it’s so efficient. 🙂

Jose Varela 2020-08-04T19:33:54.171200Z

Agree! Been doing something similar too: when there’s something I want to think more about, I schedule a talk at a local meetup (nothing fancy) to force myself to come up with a coherent story hehe

genekim 2020-08-04T20:21:06.172300Z

@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!

genekim 2020-08-05T21:14:47.214600Z

@regen WOW!!! Thank you! That’s awesome!!!

1🎉
genekim 2020-08-05T21:14:50.214800Z

…and a relief!!!

Jose Varela 2020-08-04T20:21:29.172400Z

Lol no way wait

Jose Varela 2020-08-04T20:27:23.172600Z

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

genekim 2020-08-04T20:31:41.173600Z

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

1👍
Jose Varela 2020-08-04T20:32:07.174100Z

oh wow I wasnt aware this existed

genekim 2020-08-04T20:32:59.174500Z

@plexus is responsible for the miracle that is the Clojurians Slack Archive! Thanks @plexus! 🙂

genekim 2020-08-04T20:39:26.178300Z

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.)

uosl 2020-08-04T21:25:07.178900Z

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!

Jose Varela 2020-08-04T21:26:11.179200Z

Ha thanks! @regen learned something new today

2🎉
2020-08-04T22:43:39.187900Z

@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

2020-08-04T22:45:35.189200Z

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

2020-08-04T22:50:58.190500Z

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)

genekim 2020-08-04T22:56:51.193900Z

🙏🙏🙏 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. 😂😂😂

uosl 2020-08-05T20:12:12.213200Z

I have to say your use of guardrails and check-and-throw impresses me. In my code those things are nonexistent 😹

genekim 2020-08-05T20:30:43.214400Z

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.)

uosl 2020-08-05T21:23:40.215Z

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!

genekim 2020-08-04T23:02:40.194800Z

https://github.com/realgenekim/re-frame-event-graph/blob/master/resources/trello-events.cljs Posted only for your convenience! And thanks again!!!

genekim 2020-08-04T23:09:57.196800Z

@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!

2020-08-04T23:26:52.197Z

@genekim This is all good. I like seeing how people use re-frame. I'll cycle back later today - morning meetings here

genekim 2020-08-04T23:33:03.197400Z

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: