Fork me on GitHub
#re-frame
<
2017-10-24
>
danielneal07:10:52

aw @nberger this would be useful, I implemented my own versions of reg-event-db and reg-event-fx to do error handling, which is ok but doesn't catch errors thrown in interceptors , Your version looks much better!

borkdude08:10:50

I’m not 100% satisfied with my answer here: https://stackoverflow.com/questions/46895879/re-run-subscription-on-input-change/46904084#46904084 but somehow I can’t get it to work without r/track!. Looking forward to improvements.

lovuikeng15:10:13

"share some some hard-won lessons for how to build and maintain real world re-frame apps"

yenda15:10:46

Does anyone know if there is an emacs mode for re-frame ? I would like to navigate to event and subscription definition the way it can be done with functions in cider but I can't find anything. Does it exist ? Anybody started something ?

yenda15:10:37

Might not be much more complicated than running a regexp and redirect

danielneal15:10:35

I haven't started anything, although I've got a sort-reframe function that sorts all the handlers in alphabetical order

danielneal15:10:08

jump to definition sounds doable

danielneal15:10:14

a regexp would do it

borkdude15:10:16

I think I don’t even have navigate to function for clojurescript working

yenda15:10:34

If you use emacs you just need to connect to the repl and and run cljs-repl from figwheel. Can look details if you want, it works just like in clojure

yenda15:10:20

You need figwheel-sidecar.repl-api/cljs-repl

yenda15:10:34

I don't know how you could live without it :D

danielneal15:10:57

(defun sort-reframe ()
  (interactive)
  (let ((p (point)))
    (beginning-of-buffer)
    (search-forward "(reg-")
    (sort-subr nil
               ;; nextrecfun
               (lambda ()
                 (when (not (search-forward "(reg-" nil t))
                   (end-of-buffer)))

               ;;endrecfun
               (lambda ()
                 (up-list))

               ;; startkey-fun
               (lambda ()
                 (search-forward ":" nil t)
                 nil)

               ;; end-key-fun
               (lambda ()
                 (clojure-forward-logical-sexp))

               ;;predicate
               (lambda (a b)
                 (let ((s1 (s-replace "." "/" (buffer-substring (car a) (cdr a))))
                       (s2 (s-replace "." "/" (buffer-substring (car b) (cdr b)))))
                   (string< s1 s2))))
    (goto-char p)))
^ HORRIBLE I know but useful for me 😄 because I keep all my handlers in one big file

yenda16:10:09

Thanks for sharing, our app is way too big though there is no way we put all events in one file :D

mikerod15:10:13

Interesting. I wonder how well this would work for jumping to subscription/event handler definitions via the keyword.

yenda15:10:25

It's a good starting point, I think adoption will be easier if it can be done extending cider jump to definition, when it can't jump because no repl/not a definition, it should use a dumb jump

mikerod16:10:53

Seems reasonable

deg18:10:05

Are there any good re-frame ready markdown editor controls?