Fork me on GitHub
#fulcro
<
2018-01-25
>
cjmurphy00:01:42

(swap! state #(-> %
                  st->st-1
                  st->st-2
                  ))

cjmurphy00:01:54

So you could have that code be your mutation, and it calls other 'mutations', which are not mutations but state->state transformations.

grzm00:01:32

Part of what I need to do is affect something on the server side. The state->state transformation would work otherwise.

tony.kay01:01:21

@grzm so, if you are trying to chain calls to transact! the general advice is to adjust your thinking and see if you can write it as a single thing instead. The chaining leads to complexity in code that may not be necessary. The supported chaining is on true mutations (not loads) via ptransact!. The book covers this.

tony.kay01:01:08

If you see no other way of avoiding submitting a new transaction on a post-mutation from a load, then submit a new one with transact!. The general recommendation, though, is to use something like https://google.github.io/closure-library/api/goog.async.nextTick.html to defer it until the current transaction processing is complete. Pretty sure we recently made the reconciler available in the env in the post mutations (it is usually available in the env of regular ones as well)

Drew Verlee01:01:26

wow i love the effort put into helping ppl learn about fulcro, via videos, tutorials, etc…

tony.kay01:01:36

So, I just added documentation about all of the included Bootstrap wrappers to the book. For those not aware of them: Fulcro has had (for quite some time now) a bootstrap3 namespace with helpers for using bootstrap CSS. I added these for two reasons: having a cljc implementation of the active bits means that you can easily use them with JVM SSR, and also to demonstrate that it isn’t that difficult to build wrappers around existing CSS libraries to get active components you might need that can also work well with good SSR. That said: I think it is important to know that using Javascript libraries of react components is also quite tractable (though I’d recommend shadow-cljs if you’re doing so). If you need server-side rendering, then it will require you to either write static wrappers around them (for rendering on the JVM) or use Nashorn. The latter works, but has some overhead in development effort and speed.

tony.kay01:01:07

I also expanded the html-entities namespace to include all of the well-know entities that are used in HTML for easier use in React

grzm01:01:18

@tony.kay Yeah, that's what my gut was telling me, and it's definitely in pursuit of working around another issue, rather than a desired design. I'm having trouble moving (i.e., creating, disposing, and creating anew) a KeyboardShortcutHandler between items of a list (currently working up a test case).

tony.kay01:01:29

I’ll be releasing these code expansions in a few

tony.kay01:01:07

@grzm I would expect shortcut handlers to be something you mess with on mount, no? Standard React lifecycle stuff.

tony.kay01:01:11

Fulcro 2.1.3 is now on clojars with expanded HTML entities and key codes.

tony.kay01:01:59

(fulcro.events/page-down? some-key-code-event) 
(dom/span nil (str "A dagger: " fulcro.ui.html-entities/Dagger))

grzm01:01:08

@tony.kay Yeah, I'm creating them in componentDidMount and calling .dispose in componentDidUpdate. I can see that they're no longer active (via .getDisposed), but the wrong triggers are getting called on the key events.

grzm01:01:14

I'll take a look at those examples as well.

mitchelkuijpers16:01:39

I just created my own network implementation and I needed the app inside my network object. In all the examples there is a complete-app property in the network record which never get's filled. Is this just old cruft or is there something wrong?

wilkerlucio16:01:35

in the past Fulcro had a start on the network that used to receive the app, but at some point that ended up being a circular reference and had to be dropped

wilkerlucio16:01:35

there is no good way AFAIK to handle, what I have done is to inject it later, you can send an atom to the network, and on your started-callback you can set the atom content to be the app, so after that the network can deref and read it

mitchelkuijpers19:01:35

I did exactly the same ^^

tony.kay19:01:10

Yeah, that should really be on my list of things to clean up 🙂

chrisblom17:01:55

how hard is it to use sablono with fulcro? I don't mind paying a small perf. penalty to avoid all this dom/div and #js stuff.

tony.kay19:01:39

@chrisblom should work fine. I think some people have problems with it and SSR, but I don’t use it so I can’t say.

cjmurphy22:01:43

Is there a difference between a link key and a top-level (alternatively root-level) join key? They share the fact that they are both keys in the state. A root join's value will either be an Ident or a vector of Idents, whereas the value of a link key will always be a map.