This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-18
Channels
- # admin-announcements (3)
- # arachne (8)
- # beginners (55)
- # boot (51)
- # cbus (1)
- # cider (15)
- # cljs-dev (5)
- # cljsrn (8)
- # clojure (203)
- # clojure-austin (2)
- # clojure-belgium (12)
- # clojure-boston (6)
- # clojure-czech (47)
- # clojure-dusseldorf (14)
- # clojure-estonia (1)
- # clojure-greece (42)
- # clojure-japan (2)
- # clojure-poland (4)
- # clojure-russia (97)
- # clojure-sg (5)
- # clojure-uk (41)
- # clojurescript (122)
- # code-reviews (4)
- # component (3)
- # core-matrix (19)
- # cursive (25)
- # datomic (16)
- # devcards (24)
- # editors (6)
- # euroclojure (1)
- # hoplon (88)
- # immutant (3)
- # incanter (4)
- # jobs (5)
- # keechma (1)
- # luminus (1)
- # om (44)
- # onyx (22)
- # parinfer (3)
- # planck (1)
- # proton (3)
- # re-frame (5)
- # reagent (30)
- # ring (2)
- # spacemacs (1)
- # untangled (92)
- # yada (1)
Hi, how can I initiate the state of a component with om-next? Implementation of IInitState used set the state, now it does not work for me
@fifigyuri: use (initLocalState [_] ...)
@anmonteiro: is it safe to use cellophone? Is it planned to be merged into Om at some stage? I'm currently looking at learning Om Next (first UI library, I'm also very new to programming). Was looking at basically building a client side only website (static site) that uses Om Next for interactivity. I know there is more simple and easy options out there but I am looking to incrementally work towards grokking Om Next. I'm also interested in the Om-css library you created and it's status. The cascade is a killer sometimes.
@isak, thank you, I see sometimes the best resource to check for om-next now is to go to the source codes
@grounded_sage: it's somewhat planned to be merged, no concrete predictions though
It's safe to use it, I suppose, Ladder is using it and so far so good. Same for om-css
I tried to create a dummy simulated response of a remote server based on simulated server from https://github.com/awkay/om-tutorial/blob/master/src/main/om_tutorial/client_remoting.cljs#L17, but I do not know what the server response should look like, seems like it’s not a simple database. My send
code looks like that now
(defn send [{:keys [remote]} cb]
(let [_ (println "Payload: " remote)
{:keys [query rewrite]} (om/process-roots remote)
_ (println "server query: " query)
server-response {:articles {1 {:id 1 :title "Foo" :summary "Bar"}}}]
(js/setTimeout (fn []
(println "state to merge " (rewrite server-response))
(cb (rewrite server-response))
) 1000)))
can you give me a hint what the server-response
should look like? First I want to understand that, after I could make a real communication with elasticsearch
@fifigyuri: your response looks fine to me
@fifigyuri: normally server responses dont arrive normalized
Om will normalize them for you when you call cb
I will need to make some normalization I think for the response from elasticsearch, I guess only datomic plays nice with om regarding the response
Depends whether you're communicating to elasticsearch directly
Or if your endpoint is communicating with elasticsearch
directly, having an app-server for my application would add an unnecessary extra layer
Right, but still, depending on the response format
Perhaps Om can normalize it according to the query?
@mitchelkuijpers: than it seems the problem is somewhere else, not in the response form, maybe only the state changes are not queued for rerendering
Do you do normalization?
I don’t see anything wrong then
Sorry just read the part above, lol you already said you don’t use normalization.
@madvas really cool todo app! Out of curiosity, is it datomic free or pro and where did you host it? Thanks!
I wonder what is the best way to read things as root instead of reading things recursively through another level like : dom-com/props ? I find that doing things recursively is quite troublesome especially when we have parameterized join query 😞
@leontalbot: thanks! It’s datomic free, it’s on heroku, it works out of the box! but DB is reset with every heroku spin up, so it’s suitable only for example apps I guess 😄
@fifigyuri: in order to gain the benefit of om next, you would enable normalize. It's best you need to know how to produce a good format from elastic then om next will normalize the results for you. ( Check function default-merge-tree
in next.cljs
)
@madvas thanks! I was wondering what is the cheapest way to host datomic...
@leontalbot: Actually, I’d be interested that answer as well 😄
You need to let om.next know what to update after a mutation
So in your case you need to change the call to transact!
(om/transact! this `[(core/inc-value)])
to
(om/transact! this `[(core/inc-value) :mail])
@anmonteiro: I have a question regarding gather-sends
when we change route. I have created the minimal case here:
https://github.com/rhacker/om/commit/d6dcada3155c356995767c5818d338f62eb868de
When we change route by click on the button in this case, I expect that the remote should be sent but there is none because the remote is empty. I have debugged to understand the problem but it seems like the remote send will always be empty [] if I do the remote collecting through :dom/props like in the code above because the (parser ..)
returned in the :com/props
case will be a vector, and these lines don't seem to allow it : https://github.com/omcljs/om/blob/master/src/main/om/next/impl/parser.cljc#L262-L263. I'm pretty stuck 😞
@nxqd: not a bug
the send function is not being called because you’re not returning a valid thing in your parser
you should either return true
or an AST for remote calls
e.g. {:remote true}
you’re returning a vector (the result of recursively calling the parser) which is not valid
I returned to the issue with the not updating of the component after send
, I checked and the state was updated correctly, but for some reason the updates are not queued to be re-rendered. The queues on the defui
seems to be correct. Is there a way to put queries to the re-rendering queue manually? I want to try that only for debugging purposes
I usually clone om & run my own version of it
That way you have complete control to extend it for debugging