Fork me on GitHub
#fulcro
<
2017-11-19
>
djjolicoeur02:11:00

After a 2 year break from working with clojurescript and Om, I'm looking to get back into it. Fulcro looks like a great fit, and I've been lurking in the channel for a bit so I gather that 2.0 is the way to go if I want to dive in. Before I do, does anyone know if the devguide working for 2.0?

tony.kay05:11:55

@djjolicoeur No, start at 1.0. 2.0 is coming soon, but it won’t be appreciably different…just has some improvements.

tony.kay05:11:07

2.0 should go into alpha in a month or so (maybe even a few weeks), but it won’t be ready probably till the end of the year for wider adoption

tony.kay05:11:51

Dynamic query support is the main thing that is different, but you can build some pretty big things without ever needing that

tony.kay05:11:08

@cjmurphy So, are you up and running now?

cjmurphy05:11:35

No I went back to 1.0. But I'll give it another go later on today. I guess hard to say what caused my issue with undefined calls stack trace. This time I might have a better outcome as I'll be a bit smarter about the process...

tony.kay05:11:42

ok, thanks for trying. Like I said, it is working with todomvc, the demos, the dev guide, and such…so I expect it to work without significant issue

tony.kay05:11:52

the instrument thing is definitely a no-no right now though

djjolicoeur05:11:08

thanks @tony.kay, I'll stick with 1.0 for now

cjmurphy18:11:20

@tony.kay: Upgrading to 2.0 worked fine this time. For the searching and replacing I used some Clojure functions: https://gist.github.com/chrismurrph/9c30ab2c842fb9f60a4347ba98e2746d

wilkerlucio19:11:55

@tony.kay I'm playing with the defmutation macro, I like how with that cursive can detect the symbol definition, so we auto-complete on usages 🙂

wilkerlucio19:11:23

but at same time, because the env param is at the inside functions, cursive doesn't understand and then can't bind the variables...

wilkerlucio19:11:51

what about we move the env to the top? so the binding would be picked up, like this:

wilkerlucio19:11:15

(defmutation my-mutation [env params]
  (action []
    (do-something!)))

wilkerlucio19:11:39

we could keep the current version working, so we don't break things, but also support this second one, so we don't love things like renaming (I do a lot of keyword renamting, those cases would not be currently contemplated)

tony.kay20:11:49

@cjmurphy Are you saying that worked better, or that you were just bored and wanted to code it?

tony.kay20:11:41

@wilkerlucio The problem with that is the docstrings…the docstrings would indicate the mutation was a function of two arguments then (and actually more seriously: would show usage errors when in transact because you wouldn’t even pass two parameters…in fact it would be an error to do so). But I agree, though, that it isn’t ideal that it doesn’t understand env as a result. It’s such a hard thing: macros end up making some things nicer, but hide other things that are already simple. In this particular case I felt it was much more useful to get the call-site to declaration navigation, docstrings, and code completion. If you want the bindings to work inside of the action, just wrap them in a destructuring in let:

(defmutation boo [p]
  (action [env] 
    (let [{:keys [state ...]} env]
      ...)))

tony.kay20:11:28

that way the only thing that shows up as unknown is env itself

cjmurphy22:11:20

@tony.kay Yours didn't work for me out of the box: it completed but did not make any changes. And I wanted to be able to reverse changes and exclude a directory. And I was thinking about how to do that in Clojure rather than getting into the script. I posted it up because it could be useful, especially as it will work on any OS.

tony.kay23:11:02

didn’t make any changes? Hm, wonder if that was because of the source folders or something