This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-20
Channels
- # admin-announcements (1)
- # beginners (17)
- # boot (22)
- # cider (43)
- # cljs-dev (6)
- # cljsjs (2)
- # clojure (29)
- # clojure-austin (7)
- # clojure-estonia (1)
- # clojure-russia (62)
- # clojure-sg (1)
- # clojurebridge (2)
- # clojured (1)
- # clojurescript (89)
- # datomic (8)
- # hoplon (333)
- # jobs (3)
- # ldnclj (2)
- # leiningen (10)
- # luminus (1)
- # off-topic (9)
- # om (46)
- # proton (4)
- # re-frame (13)
- # reagent (29)
- # yada (11)
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?
@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
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?
In your project that you want to use it the dependency will be: [org.omcljs/om "1.0.0-alpha31-SNAPSHOT"]
(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
@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 I think that is amazing of om.next.
piece of my app-state { :record {:cliente [:cliente 2]}} . Note that my init-state is {}
Sorry. My issue is fixed in the latest master!
Hmm a No queries exist for component path
is in most cases a component stealing queries, isn't it?
@iwankaramazow: check the "Common Mistakes" section here https://awkay.github.io/om-tutorial/#!/om_tutorial.E_UI_Queries_and_State
I think it may help you
@iwankaramazow: normally yes, some kind of weird stuff you're doing in query composition
Thanks for the responses, I'll try to debug it
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.
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?
not sure if this is idiomatic, but I'm using the lifecycle methods of my Root
it's not a React Native app though
why can't you pass the props down in you navigator element?
just pass the (om/props this)
down from the root to whatever child you're rendering
Well, when I prevent the Navigator from re-rendering (returning false in shouldComponentUpdate) it doesn’t pass the props down to child components.
Any reason why your navigator should return false in shouldComponentUpdate?
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.
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?
yes, everything has to be passed down from the root
the root gets its props injected from the rootquery
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
you're navigator sounds strange
if it gets its props, the routing resets?
In my opinion the navigator should render based on those props it receives
Yeah, unless I’m using it wrong…which is a strong possibility.
I’ll take another look at it. Thanks guys for clarifying how things are supposed to work.
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.
the full query at the root gets composed to [{:route [:url]} :title {:overview/panels [:title :body [:overview/count _]]} {:navbar/items [:name :href]}]
I can't seem to find the problem
Nevermind :hugging_face:
the :title
key was ambiguous.
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}]))
@jamesmintram: I think there's no need for the quote there
user=> (let [subquery :foo]
#_=> `[{:list/one subquery} {:list/two subquery}])
[{:list/one :foo} {:list/two :foo}]
user=> (let [subquery :foo] #_=> [{:list/one subquery} {:list/two subquery}]) [{:list/one :foo} {:list/two :foo}]
but here it does:
user=> `[{one :foo}] [{user/one :foo}]
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?
correct