hn icon indicating copy to clipboard operation
hn copied to clipboard

AOT-ify build and minor improvements

Open atdixon opened this issue 4 years ago • 0 comments

@vlaaad Cool project!

In evaluating cljfx I played around with your cljfx/hn reference project and ended fixing up a few things along the way. I'm happy to factor out any of these into a separate PR if you'd like any of these changes a la carte:

When I started the app, it seems it fanned out too many network requests at once and I hit the (in)famous "Too many open files" issue on my mac.

HTTP exceptions were emitted and dispatched to event/handle but the emitted exceptions did not have an ::event/type so there were Clojure errors about trying to do a multi-method dispatch on nil. To fix this, I changed the emitted exceptions to include an ::event/type ::event/exception and I added a simple (defmethod handle ::exception ...) to put the recent error into the :state so that the view would render any such errors in red.

Incidentally I thought this might be a common issue for others so to eliminate the actual HTTP exceptions, I limited the number of stories rendered (i.e., (take 100 ...).

Additionally I was curious about achieving an AOT build, so I added AOT as part of the uberjar build -- it involves leveraging the (Platform/exit) 'trick' you describe here (see build/..). This also required upgrading deps.edn to be compatible with recent clojure tooling as well as updating and using the latest seancornfield/depstar capabilities. This demo of AOT build may be interesting to other cljfx users!

I've tested all of this and updated the README to reflect these changes. If any of this is useful to you, great, just wanted to share these changes just in case. Thanks for the cool framework!

atdixon avatar Dec 12 '20 23:12 atdixon