Fork me on GitHub
#om
<
2016-10-04
>
jasonjckn04:10:37

in om.next: how can I pass computed props down from parent to grandchildren implicitly, sort of like clojure binding macro

levitanong12:10:42

I’m trying to use dom/use, and i’m getting a Cannot read property ‘apply’ of undefined error. Any ideas?

levitanong12:10:58

It does seem to render properly anyway though.

anmonteiro12:10:38

@levitanong probably because React.DOM.use doesn’t exist

anmonteiro12:10:57

I have a feeling that the use tag shouldn’t be in om.dom

levitanong12:10:06

It actually is in there though 😮

anmonteiro12:10:09

try js/React.createElement “use”

anmonteiro12:10:21

what is there?

anmonteiro12:10:35

I know. I have a feeling it shouldn’t be though

anmonteiro12:10:48

as in, we should remove it.

levitanong12:10:44

ahh. Why though?

anmonteiro12:10:09

because React.DOM.use doesn’t exist

levitanong12:10:23

Wham, I have a comprehension problem

levitanong12:10:27

haha! okay I get it now

levitanong12:10:43

That’s odd though, because react supports the xlinkHref attribute

levitanong12:10:51

which afaik, only use uses

anmonteiro12:10:07

my feeling is that JSX translates to React.createElement

anmonteiro12:10:16

so that it can work with user-created components

anmonteiro12:10:35

so they don’t really maintain React.DOM elements that much?

levitanong12:10:04

dang, that’s a cryin’ shame

levitanong12:10:11

will try out your suggestion, brb

levitanong12:10:40

ooof, that’s tricky. server side rendering 😛

anmonteiro12:10:38

right, you can still use dom/use on the server though

levitanong12:10:37

ah, and that’s why it seems to work client-side

levitanong12:10:52

because the server is sending the use tag already rendered. Is that it?

levitanong12:10:44

That fixes the issue, thanks @anmonteiro!

levitanong12:10:03

I guess that’s a case for keeping use in dom

anmonteiro12:10:07

yeah that might be right

levitanong12:10:08

for the prerendering

levitanong12:10:42

Perhaps in that case we can make dom/use switch to createElement instead of react.DOM?

anmonteiro12:10:19

@levitanong IMHO what we should have is a function on the server side that acts like React.createElement

anmonteiro12:10:42

so that we can render all elements that React doesn’t support on the server too

levitanong12:10:33

That sounds good

anmonteiro12:10:58

@levitanong can you open an issue please?

levitanong12:10:56

@anmonteiro happy to. would dom/____ still be the call though? or would there be a new public function altogether?

anmonteiro12:10:12

@levitanong should be a new funcition like dom/create-element or something

alex-glv13:10:23

Any obvious reason that I am missing that om/component? returns false on a component specified with defui … ?

alex-glv13:10:13

(om/component? ColumnList)
on
(defui ColumnList
  static om/IQueryParams
  (params [this]
          {:id nil})
  static om/IQuery
etc...

anmonteiro13:10:29

@alex-glv that’s because ColumnList is not a component

anmonteiro13:10:58

this is probably not clear to everyone, but by component we mean the instance

anmonteiro13:10:09

and ColumnList is a component class

alex-glv13:10:35

ok, so

((om/factory ColumnList))
should then yield a component?

anmonteiro13:10:11

sorry that was wrong

anmonteiro13:10:28

(om/factory ColumnList) will return a factory

anmonteiro13:10:45

((om/factory ColumnList)) will return a component, yes

alex-glv13:10:25

Makes sense now, cheers!

peeja14:10:56

Does send always receive the entire root query as processed by the parser?

peeja14:10:16

or does it sometimes only get a subset when part of the page changes?

anmonteiro14:10:01

@peeja send will receive a map of {target => query}

anmonteiro14:10:35

and query will be what you return from your parser’s target

anmonteiro14:10:52

if you return true, it’ll be the root query, I suppose

anmonteiro14:10:57

but you can transform the AST

peeja15:10:03

Right, I get that

peeja15:10:37

What I mean is, will it be the transformation of the entire root query, or will it sometimes only be the transformation of one or two keys' worth?

anmonteiro15:10:39

if you return target ast, it’ll be ast->expr of the AST you return

peeja15:10:00

The parser doesn't always run against the entire root query, does it?

peeja15:10:18

Or, rather, the non-target reads don't. Do the target reads?

anmonteiro15:10:18

@peeja oh I get what you’re asking. I think full-query is only ever passed to the parser in local mode

peeja15:10:26

If I set-query! a component, will my remote only get a part of the query that it gets when the page loads, because that's all the parser had access to this time around?

peeja15:10:52

I guess the easiest way to think about it is: if my reads all have {target true}

peeja15:10:06

so the send would normally get the raw query

anmonteiro15:10:15

it’ll be the root

peeja15:10:44

Ah, perfect, that's exactly what I'm after. Thanks!

peeja15:10:08

Still trying to get my head around what's incremental and what's not

anmonteiro15:10:38

the incremental part is only in the async rendering loop

jfntn15:10:56

Has anyone found a good approach to spec the parser’s read and mutate fns?

peeja15:10:50

@jfntn Is it especially difficult?

peeja15:10:22

(I haven't tried, but I'm curious)

jfntn15:10:08

I’ve found it tricky yes

jfntn15:10:54

I had a hack using a multimethod on the dispatch key for spec’ing the args, but you end up defining a predicate rather than a real spec so that doesn’t compose as well for complex params

peeja15:10:36

Is it just that multimethods themselves are tricky to spec?

jfntn15:10:41

And for return values I came up dry so far

jfntn15:10:16

Yeah I don’t think there’s any om-specific here

peeja15:10:25

I mean, I'm not sure I can imagine a spec that wouldn't cover all reads and mutates in all apps

peeja15:10:40

Is it appropriate for a spec to get more specific than that?

jfntn15:10:13

not sure what you mean?

levitanong16:10:49

@jfntn May we see a code snippet to get more context?

alex-glv18:10:41

Possibly anyone working on om.next app that implements navigation and traditional CRUDy things. I’d like to take a look for some implementaion patterns, ie how to pass filter / constraints, navigate between entities etc.

jfntn18:10:43

@levitanong scraped my last attempt, will make sure to post here when I try again