This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-30
Channels
- # bangalore-clj (1)
- # beginners (9)
- # boot (51)
- # cider (20)
- # cljs-dev (419)
- # clojars (1)
- # clojure (338)
- # clojure-brasil (64)
- # clojure-dev (7)
- # clojure-greece (2)
- # clojure-italy (3)
- # clojure-russia (10)
- # clojure-spec (127)
- # clojure-uk (12)
- # clojurebridge (2)
- # clojurescript (132)
- # core-async (8)
- # cursive (37)
- # datomic (34)
- # dirac (5)
- # events (1)
- # funcool (3)
- # hoplon (39)
- # jobs (3)
- # leiningen (3)
- # off-topic (16)
- # om (44)
- # onyx (7)
- # pedestal (20)
- # protorepl (1)
- # random (1)
- # re-frame (64)
- # reagent (6)
- # specter (4)
- # test-check (9)
- # untangled (17)
- # vim (4)
is it required that :keyfn
be an integer? When prerendering an om.next app, when trying to pass to :keyfn
a fn that returns either a keyword or a string, the compiler complains:
java.lang.IllegalArgumentException: Key must be integer
oops, scratch that
I’m being stupid
typo 😛
Does every entry in the om next query cause call to read with the entry as the key? Eg I want to have UserList and a User, what's the best way to fetch the data from remote? Define :user/list read key? Is there a definitive guide on the query expressions and read, or is it mostly blogs and wiki pages?
@alex-glv Generally, only the individual queries of the root component will trigger reads in the parser.
(defui ChildComponent
static om/IQuery
(query [this]
[:child-query1 :child-query2])) ;; these don’t trigger reads
(defui RootComponent
static om/IQuery
(query [this]
[:query1 :query2 {:join-query (om/get-query ChildComponent)}])) ;; Generally, compose all subqueries into root query.
;; triggered reads are: :query1 :query2 :join-query
I would place the remote query in the :user/list read key.
I don’t think we’ll have a definitive guide until om.next settles down into not-alpha. In the meantime, this is a very good resource: https://anmonteiro.com/2016/01/om-next-query-syntax/
Is it ok to have ident’s on the components in a union?
@gardnervickers: I think it's a requirement for a union query
Anyone have any experience writing Om components and using them within a JavaScript project?
The best strategy I have at the moment is to have the JavaScript project create a new div as an injection point for an Om root. This would involve have a React root (built with Om) inside of another React root (built by the top-level JavaScript project).
what approaches have people been using for mocking the parser in testing the ui? I'd like to do some browser-based testing and want to test the parser logic, but don't want to set up a backend to handle remotes.
@grzm you don’t need to setup backends
the parser never sends anything to the remote
the result of parsing something in “remote mode” is a query expression
not a remote call
So when I create a reconciler, I just leave the remotes empty and it should all be good?
depends on what you want to test
lol. At this point I want to make sure I haven't broken mutations when I do refactoring/code updates. Like when I click a button that triggers a transaction I'm getting the appropriate state change.
what I meant is: you can test remote interactions, and if you want to do that, you don’t want to leave remotes empty in the reconciler
So I guess there are two things: one is that the components are rendering properly, and that the mutations work
you can e.g. have a different send
function
@grzm so one thing you might have not realized
is that you don’t need to assemble a reconciler
you can test that mutations work with only a parser
(def p (om/parser {:read read :mutate mutate}))
(p {:state (atom init-state)} '[(do/this!)] )
well...
since the state is an atom you can have a reference to it somewhere and deref it for checking the result, right?
I don’t remember what the result of a mutation is from the top of my head
you’ll have to check it out for yourself 🙂
@grzm sure, I’ll let you know my hourly rate 🙂
I'm confused about this error, (str "No queries exist for component path " cp " or data path " path')
https://github.com/omcljs/om/blob/3a8229c4a843c9978ced8eec94f0fa33ae57b869/src/main/om/next.cljc#L1962