This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-24
Channels
- # admin-announcements (25)
- # beginners (132)
- # boot (89)
- # cider (26)
- # clara (12)
- # cljs-dev (10)
- # cljsrn (11)
- # clojure (151)
- # clojure-germany (8)
- # clojure-russia (1)
- # clojurescript (137)
- # cursive (33)
- # datavis (28)
- # datomic (3)
- # devcards (8)
- # hoplon (5)
- # immutant (11)
- # jobs (4)
- # ldnclj (58)
- # lein-figwheel (7)
- # off-topic (95)
- # om (114)
- # onyx (91)
- # parinfer (38)
- # portland-or (1)
- # re-frame (26)
- # reagent (1)
I took a working copy of the Remote auto-correct tutorial and added a new root parent component to the AutoCompleter component, modeled after @jdubie’s om-next-router-example. That stopped the remote :send
function from being called like it was before. I delineated the small amount of code I added at the bottom of this Gist: https://gist.github.com/AdamFrey/201aedc47ee0014c7646
I’d be very thankful if someone could take a look and see if I’m doing something wrong.
The only thing it does is add a union query at the top level. I get no errors, everything renders correctly, but :send
is never called.
@adamfrey: I think it’s because in your :page
read
method you are not calling the parser in remote mode so you are never returning a remote query
ok, I didn’t know about “remote” mode, so I think that’s part of my problem. The remote hook still isn’t called when I substituted your code, but I’ll keep trying things
the parser either returns data returned from :value
in your read fn or a query to execute on the remote server when run in remote mode, so you need to get it so the remote mode when run on your root components query returns your remote query.
so if you called the parser with [(:search/results …)]
you should see the remote query, and calling it with :pages doesnt return it which is the bug
hello, there is someone willing to help am om adventure buddy, I would like to someone else to test this snippet (no dependencies, if you have a devcards+om.next project setup it will do) and see if it's working, this is a devcards of the example on the om.next quickstart page, and I can't get it to work here https://clojurians.slack.com/files/wilkerlucio/F0F54JPQT/-.clj
here when I click on the button, the parser state updates correctly, but the ui don't
You need to add query params to transact so om knows what you want updated, i.e. (om/transact! this '[(increment) :count])
I'm building an om.next query from subcomponents which have overlapping data needs. Is there a way to dedup the query (kind of deep merge I guess) so that the duplication is removed?
Something like...
(= (query-scrubber [:A {:B [:C]} {:B [:D]}] [:A {:B [:C :D]}])
@taylor.sando: tried that, still no updates =/
@olivergeorge: I believe you can do dedup using Transit at the data transfer level
@wilkerlucio - thanks, not sure I understand how that might work. I've got a little helper script which transforms everything into maps and does a deep merge.
@dnolen: for the initial read, :query-root
will be :om.next/root
even if all my components have a om/Ident and :pathopt true
is set. After a mutation, the reader function will get called with the query-root set to the ident.
@dnolen: the other thing: i do not know why this reader is not returning a {:value ...} https://github.com/omcljs/om/blob/651a8b603503b5803e2deac9b54bff52cf58a780/src/devcards/om/devcards/core.cljs#L326
@tony.kay Bit thanks for https://github.com/awkay/om-tutorial The idea of using devcards + figwheel for the tutorial is just amazing, super cool!
@thomasdeutsch: of course since nothing has an ident the first time due to pre-normalization. You'd have to fix the initial data to make that work.
@thomasdeutsch: probably just a bug
@olivergeorge: there is not. Lift the query if you must. But I would perfectly fine with duplication
@adamfrey: using a union query at the very root of the application is not supported. Will probably throw if you try that from now on.
@dnolen: so, basically, :query-root
can not be used in my initial read - and the :db-path
strategy from @tony.kay is still the only solution, since i am unable to set :query-root manually.
@thomasdeutsch: this requires some thought, currently you must start with a QueryRoot
and you’re asking to start at IdentExpr
@dnolen: No, it is not about the place i am starting from - it is the missing option to tell the parser on what entity to parse on, when i use a recursive reader (a reader that is calling the parser on a sub-query)
@thomasdeutsch: I don’t know what you are trying to do, but it seems you are not understanding what I said
@dnolen: good to know. I haven’t seen any other ways of doing top level “routing” from community examples, so I’ll have to do some more reading and experimenting. @jdubie, David’s message about Union Queries is relevant to your om-next-router-example
@adamfrey: as much as community help is appreciated I just don’t have time to read through all these other examples that people are generating for lack of time
@wilkerlucio: looking
@wilkerlucio: ah k this is devcards only issue
@bhauman: needs to provide state hooks for stuff like this to work, I haven’t followed up with him about this
I have tests that exercise my app and change the app state, but assertions immediately after mutations fail because they happen before the next render is flushed. They pass if the test sleeps ~16ms after mutations. Is this the right way to handle waiting for renders, or is there a better strategy?
@dnolen: I also tried on one external page and it didn't worked there too, but this one needs more confirmation from my part, I'll try a new setup and hit you if it still an issue
@wilkerlucio: I doubt that but I’ll double check
what's in there that's not possible to work on devcards?
since I have other more complicated things working on devcards, I don't understand why this one doesn't
so, you are saying that currently om.next doesn't work at all on devcards? nothing would update?
@wilkerlucio: I just confirmed your example works fine on a normal page as I said
ok, thank you
getting to the point where I’m more than happy to take PRs - I wrote up some quick notes on the contribution process
(defui Counter
Object
(componentWillMount
[this]
(om/set-state! this {:count 0}))
(render
[this]
(let [count (om/get-state this :count)]
(dom/button
#js {:on-click #(om/update-state! this update :count inc)}
(str count " +1")))))
(def counter (om/factory Counter))
they do
you have a mistake there
in React it's onClick
and not on-click
the wiki documentation for Om Next doesn't have docs for update-state!
thanks @anmonteiro but it still does not work
it does work for me
@anmonteiro: feel free to add!
just checking
will do
also no docs for get-ident
adding that one too
shouldn't this increment infinitely using requestAnimationFrame?
(defui Counter
Object
(componentWillMount
[this]
(om/set-state! this {:count 0}))
(componentDidMount
[this]
(om/update-state! this update :count inc))
(componentDidUpdate
[this _ _]
(om/update-state! this update :count inc))
(render
[this]
(let [count (om/get-state this :count)]
(dom/div nil
(str "COUNT: " count)))))
(def counter (om/factory Counter))
Is this the intended AST representation of a union? (The key in the child is "[:type1 [:field]]")
Hi folks....Completely new to clojurescript and Om. Could anyone offer a bit of advice on how to properly use/intergrate the cljs fabricJs library with Om.
@bannerintheuk: that’s actually more of generic React question. This answer applies http://stackoverflow.com/questions/31711314/use-custom-object-inside-react-component
Much appreciated..thank you
This feels like a really stupid question, but is anyone successfully using reference cursors in om (now, not next)?
I've got a fresh install from lein-figwheel copy-pasting the sample code from https://github.com/omcljs/om/wiki/Advanced-Tutorial#reference-cursors and I'm getting Uncaught Error: No protocol method IRenderQueue.-queue-render! defined for type cljs.core/Atom: [object Object]
@kevinmershon: make sure you are not trying to use any of the alphas
Pretty sure I'm on 0.9.0 but I'll double check when I'm back to my computer.
@kevinmershon: yeah I would double check, if that doesn’t work I would also try the release prior
@dnolen: Definitely worth a shot. I have no idea how you have time to do a third of what you're doing. The fact you still take time to make yourself available to the community on top of your development time and talks is just astounding.
Getting the same rolling back to 0.8.2. Looks like I'm using channels!