Fork me on GitHub
#re-frame
<
2020-05-19
>
David Pham03:05:34

So if you code with immutable objects without methods and use functions on them, do you code in OO?

ryan echternacht04:05:09

Why are you so interested in my object orientation? I was born this way

4
mikethompson04:05:33

Sorry, just for clarity, I was joking around with Bryan earlier (we know each other). IMO, re-frame is not OO in any way whatsoever. And, in an earlier life, I wrote commercial grade courseware on OO design and OO languages. And I programmed professionally in Smalltalk. And Eiffel. And C++. Etc. So I feel confident making this assessment.

ryan echternacht04:05:16

@mikethompson @neo2551 lol, i was just trying to continue the joke. shoulda added a smiley — my b

Cameron05:05:00

Ah I see, so mikethomspon would like to learn more about OO, using the OOP language re-frame. I think its all cleared up for me guys

jdkealy20:05:46

Is there some library / solution that supports getting unhandled exceptions, writing the re-frame call stack to a file, uploading it to S3 and allowing an admin to “replay it” in development mode? Like a combination of Sentry/Fullstory powered by the immutable data structures of CLJS/re-frame ?

jdkealy20:05:32

I guess the first part of the question would be, is it possible to export a user journey and replay it in re-frame ?

oliy13:05:39

i saw a talk on this at euroclojure one year, https://www.zimpler.com/zimplers-developer-jean-louis-giordano-will-present-at-euroclojure-2016 this was the talk where they presented exactly this

oliy13:05:02

i had a quick look on their github and couldn't find anything that looked like it, but you might be able to find jean louis and ask him

mikethompson22:05:41

@jdkealy There's no library that I'm aware of. But you can roll your own solution reasonably easily. The most modern technique might be to: • Write a global interceptor which captures events and app-db state (global interceptors is a new feature and no docs yet) • Hook window.onerror to catch exceptions and, in your handler, do the logging you want to do (to S3?) • Come up with a way to replay events (this part has some subtleties) Global Interceptor --------------------- The Global Interceptor would: 1. Capture each event into a collection 2. Checkpoint app-db after each event has run (and save that too into a collection) So imagine this Global Interceptor accumulating into a vector of maps which each element looking like this:

{:event       [:whatevers "dad joke"]
 :new-app-db  <...>}
Because of structural sharing, keeping "previous" app-db around is normally very little overhead (assuming that app-db doesn't change too much with each event). Logging On Exception -------------------------- ??? it varies depending on your target Replay -------- You have to obtain: 1. A snapshot of the state of app-db at a point in time 2. Start to feed events through (by just dispatching them)

mikethompson22:05:02

Now, the subtlety with replaying events is that you probably don't want to reply all of them.

steveb8n22:05:25

This is really useful. it’s a shame it will not be captured for long by slack. I need both of these features and was looking into goog.ErrorReporter instead of a re-frame level solution

mikethompson22:05:28

Or you might want to reply them, but turn off effect handlers

mikethompson22:05:35

For example, if an event handler triggers an HTTP get, which will later cause an success event ... you either want: 1. The original success event replayed OR 2. The success event caused by the replayed GET But not both

🙏 4
mikethompson22:05:16

So, in such cases, you have to filter out one of these events: 1. stub out the effect handler so the GET doesn't actually happen 2. Not replay the success event, and instead somehow wait for the new success to hit, before then continuing on with the rest of the event replay