Fork me on GitHub
#om
<
2016-02-20
>
samedhi04:02:05

When going through the Remote Synchronization Tutorial I am getting Use of undeclared Var om.next/query->ast in the send-to-chan method. Any idea what I am doing wrong?

tawus05:02:17

@samedhi: I did get a similar error. I don’t remember what fixed it but the problem might be the om version you are using. Just a wild guess simple_smile

thomasdeutsch10:02:56

i know this has been asked before ( but i can not find the info ) . What are the steps i need to take to work with the latest master instead of the latest alpha?

cjmurphy11:02:00

clone it from github. Then in its directory lein install.

cjmurphy11:02:24

In your project that you want to use it the dependency will be: [org.omcljs/om "1.0.0-alpha31-SNAPSHOT"]

thomasdeutsch12:02:41

(Update: Fixed) In a minimal om.next app, i have found a problem where the root gets rendered twice (tested this with the latest master). https://gist.github.com/ThomasDeutsch/0c1e8e4ac6627ce93ae5

geraldodev12:02:19

@thomasdeutsch: When the action to be triggered of a transact! is set-query I go straight to set-query!, the changed key will trigger re-read , so no need to pass the key on the list of reads, and the other side effect of set-query! is that the data correspondent to its shape will get merged into the app state, so no need to massage app-state in a transaction to accomplish that. When I started I've got the same impression. An example is [{:record [({:cliente [:id :nome :endereco :bairro :cep :cidade :versao]} {:pk {:id 2}})]}]. It' will trigger a read on :record (the root node) and whatever that read returns will be merged into app-state. Much less code simple_smile I think that is amazing of om.next.

geraldodev12:02:55

piece of my app-state { :record {:cliente [:cliente 2]}} . Note that my init-state is {}

thomasdeutsch12:02:32

Sorry. My issue is fixed in the latest master!

iwankaramazow13:02:32

Hmm a No queries exist for component path is in most cases a component stealing queries, isn't it?

marianoguerra13:02:01

I think it may help you

anmonteiro13:02:19

@iwankaramazow: normally yes, some kind of weird stuff you're doing in query composition

iwankaramazow13:02:12

Thanks for the responses, I'll try to debug it

seantempesta13:02:09

What’s the idiomatic way to do routing with om.next? I’m writing a react native app and every routing solution I’ve seen requires putting a Navigator element in the root, but then props are not propagated down to child components. Also, if the props in the root component change it re-renders the Navigator component which resets the routing.

seantempesta13:02:51

I’m thinking of doing a core.async pub/sub system and just having the child components subscribe to changes in the root. Does that sound right?

iwankaramazow13:02:31

not sure if this is idiomatic, but I'm using the lifecycle methods of my Root

iwankaramazow13:02:50

it's not a React Native app though

iwankaramazow13:02:40

why can't you pass the props down in you navigator element?

iwankaramazow13:02:03

just pass the (om/props this) down from the root to whatever child you're rendering

seantempesta13:02:05

Well, when I prevent the Navigator from re-rendering (returning false in shouldComponentUpdate) it doesn’t pass the props down to child components.

iwankaramazow13:02:14

Any reason why your navigator should return false in shouldComponentUpdate?

seantempesta13:02:09

Well, my navigator is a child of the root component. Any time the props update in the root it re-renders the navigator component and my routing resets.

seantempesta14:02:22

So om.next components have to receive data via props from the root? It seems like if each component is specifying which data it cares about with IQuery they could act independently?

iwankaramazow14:02:04

yes, everything has to be passed down from the root

iwankaramazow14:02:20

the root gets its props injected from the rootquery

geraldodev14:02:21

The point of each component declaring the needed data is gather all that information and make one request to the server. When the data arrives the reads of root nodes are triggered. Bring this data to the children is your responsibility

iwankaramazow14:02:57

you're navigator sounds strange

iwankaramazow14:02:05

if it gets its props, the routing resets?

iwankaramazow14:02:30

In my opinion the navigator should render based on those props it receives

seantempesta14:02:43

Yeah, unless I’m using it wrong…which is a strong possibility. simple_smile

seantempesta14:02:21

I’ll take another look at it. Thanks guys for clarifying how things are supposed to work.

iwankaramazow15:02:05

I might need some help with a query... [:title {:overview/panels (om/get-query o/OverviewItem)} {:navbar/items (om/get-query nav/MenuItem)}] This is a valid query, isn't it? Problem is with :title I get a No queries exist for component path. Without :title no errors in the console.

iwankaramazow15:02:37

the full query at the root gets composed to [{:route [:url]} :title {:overview/panels [:title :body [:overview/count _]]} {:navbar/items [:name :href]}]

iwankaramazow15:02:40

I can't seem to find the problem

iwankaramazow15:02:43

Nevermind :hugging_face:

iwankaramazow15:02:04

the :title key was ambiguous.

jamesmintram16:02:47

Reading the code from the Om Next Normalization tutorial - I cannot see why the RootView query is Quoted - could someone explain?

static om/IQuery
  (query [this]
    (let [subquery (om/get-query Person)]
      `[{:list/one ~subquery} {:list/two ~subquery}]))

marianoguerra16:02:02

@jamesmintram: I think there's no need for the quote there

marianoguerra16:02:19

user=> (let [subquery :foo] #_=> `[{:list/one subquery} {:list/two subquery}]) [{:list/one :foo} {:list/two :foo}]

marianoguerra16:02:26

user=> (let [subquery :foo] #_=> [{:list/one subquery} {:list/two subquery}]) [{:list/one :foo} {:list/two :foo}]

marianoguerra16:02:16

but here it does:

marianoguerra16:02:18

user=> `[{one :foo}] [{user/one :foo}]

iwankaramazow17:02:31

Hmm, with routing if you compose the queries of the router and active-component like (into [] (concat routing-part-of-the-query (om/get-query active-child-component)) This probably won't work, because I am stealing the child-component's query?