Fork me on GitHub
#om
<
2016-04-09
>
tomjack00:04:06

I think I understand the bug in the diff just above. transact! on a component with an ident will queue up any other components with the same ident. If those components' paths have changed, but their parents don't rerender (say because a whole chunk of state got moved), they will still have the old paths

tomjack00:04:31

so I think the example there is pretty much the simplest reproduction. we have User with an ident, Blog which doesn't rerender, and Author with the same ident which gets a stale path

tomjack00:04:24

not sure how to fix the bug except by :pathopt true

tomjack00:04:30

maybe it really is a user error, though? you need to make sure parents rerender when paths change?

slester05:04:57

Complete newbie, any reason why something like (dom/div {:className "test"} "Hi!") doesn't have any attribute? I've tried {:style "stuff"} and others as well, and nothing

taylor.sando05:04:55

The first argument has to be a javascript object, so it's either

#js{:className "test"}
or
(clj->js {:className "test"})

slester05:04:44

Oh, great! Could you point me to a recent tutorial then? Things from ~8 months ago are simply broken.

taylor.sando05:04:44

Are you using om now, or om next?

slester05:04:51

(Note that I wasn't using https://github.com/omcljs/om/wiki/Basic-Tutorial because I find it mind-blowingly difficult to follow for some reason.)

taylor.sando05:04:30

I haven't used om now in awhile, so I'm not sure where the latest tutorials are for it.

taylor.sando05:04:33

I'd probably use reagent/re-frame over om now.

slester05:04:09

oh? 😐

taylor.sando05:04:42

That would just be my preference though.

tomjack05:04:24

wondering about (pub)sub

tomjack05:04:44

it's tempting to try to do sub in remote reads. but what about unsub?

taylor.sando05:04:35

You can send messages/transactions in componentWillUnmount

taylor.sando05:04:46

It is called when a component will be removed

tomjack06:04:07

yes, I am looking for solutions which don't require component lifecycle to know about subscription

tomjack06:04:14

there are other cases, too. e.g. set-query!

tomjack06:04:00

I would be OK with doing something generic in componentWillUnmount I think

manutter5114:04:52

One thing that’s throwing me a little bit in trying to learn Om Next is the argument quoting. For instance, the Quick Start defines a mutate function that looks for an “increment” key, but it’s called like this: (fn [e] (om/transact! this '[(increment)])). Why is it “quoted vector containing a sequence containing increment” instead of, say, (fn [e] (om/transact! this ['increment]))?

manutter5114:04:39

This is amazing, no sooner do I post the question than I go back to the “untangled” tutorial, and the next lesson on my list has a note about quoting.

iwankaramazow18:04:17

@manutter51: That's just the way it is

manutter5118:04:04

Cool, thanks, I’ll check it out

manutter5118:04:26

The untangled tutorial also pointed me to the Datomic Pull tutorial, which also explains a lot

iwankaramazow18:04:44

I was just copying the link 😄

iwankaramazow18:04:19

also ['increment] doesn't make sense (I think)

iwankaramazow18:04:29

how are you gonna throw params in the mix?

iwankaramazow18:04:46

Let's say you want to increment with a certain amount

iwankaramazow18:04:33

'[(increment {:amount 5})] makes more sense in terms of the standard clojure(script) datastructures

seanirby23:04:39

i want to get the uuids that om creates on mutates. are these kept track of somewhere or do I need to listen to some event?

taylor.sando23:04:47

They are stored in the reconciler at [:config :history]

seanirby23:04:36

taylor.sando: shoulda thought to log the reconciler. thanks! simple_smile

seanirby23:04:31

taylor.sando: how do you usually associate a UUID with the mutate that created it? I could store it in the app-state along with the mutate but that seems redundant.

taylor.sando23:04:37

I've never actually used the history or undo, I just know that is where the information is.

seanirby23:04:59

cool, thanks