This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-19
Channels
- # aleph (11)
- # aws (1)
- # beginners (14)
- # bitcoin (1)
- # boot (41)
- # cider (6)
- # cljs-dev (1)
- # cljsrn (13)
- # clojure (138)
- # clojure-italy (10)
- # clojure-nl (1)
- # clojure-poland (2)
- # clojure-russia (62)
- # clojure-sg (2)
- # clojure-spec (31)
- # clojure-uk (51)
- # clojurescript (109)
- # core-matrix (1)
- # core-typed (1)
- # cursive (63)
- # datomic (10)
- # emacs (9)
- # euroclojure (1)
- # hoplon (112)
- # immutant (16)
- # jobs (2)
- # lumo (5)
- # off-topic (14)
- # om (54)
- # onyx (17)
- # parinfer (23)
- # pedestal (2)
- # re-frame (41)
- # ring-swagger (23)
- # spacemacs (9)
- # specter (10)
- # uncomplicate (5)
- # vim (1)
I think the problem is the om/build-all
, try wrapping that in a dom/div
.
i am not so sure because i was getting the same error before even adding that part but i will try in a sec
done that same error
What about (dom/p (:first state))
, does that not need a second nil
argument? I'm sorry, no longer familiar with om.now.
Hmm it may be because i think it tries to make that text a class
let me check
dom
functions accept two arguments (attrs and children). Anyway, the error suggests render is returning something bad.
Do you not have a line where the error is raised?
first adding nil doesn't help but i think it shows that there is something really wrong with the code
second no it doesn't specify the line
(about first it gives me an object null)
wow programming at its finest after a restart the object null disapears
Hmm. I think I may have been normalising things myself right before om.next would normalise, so double normalisation. π
@jcf make sure the attribute you are using to form the ident is listed on the query part, I personally had trouble with this a bunch of times π
Oh wait! So my om/IQuery
should include the attribute in the om/Ident
?
So where I'm using :email/by-uuid
I should really be using :email/uuid
because that's what's in the query?!
No @jcf, the second part of the ident.
Problem now is the query generated by om.next and sent to the server doesn't include the ident, so instead of something like {[:email/by-uuid UUID] [:db/id ...]}
being posted, I'm getting just [:db/id ...]
and that can't be read.
I'll have attributes shared by entities for sure. I guess I'm supposed to use a hash map in the query instead of relying on the ident feature.
So my query in the detailed view should be {:email/details [:db/id ...]}
because idents don't work the way I think they do.
But then how do I know the ID of the thing I'm supposed to return⦠you can't just send a list of attributes to the server without some kind of ident.
@jcf keep in mind that idents are mostly a way for you to normalize your data into the database, when communicating with the server is better if you send everything you need as parameters, something like ['(my/mutation {:db/id 123 :user/email "blabla" :user/whatever "foobar"})]
oh, to fetch idents are good actually
I was thinking more about mutations
Right now I have a list page that pulls summary info, and I'm trying to get a details page per item that will pull more detailed info.
but you have to parse this on your server-side, aren't you getting the full query there?
This is what's being sent to the server:
["~:db/id","~:email/body","~:email/sent","~:email/subject","~:email/uuid"]
For this query/ident:
static om/Ident
(ident [this m]
[:email/by-uuid (:email/uuid m)])
static om/IQuery
(query [this]
[:db/id :email/body :email/sent :email/subject :email/uuid])
I was expecting the generated query to include the ident automatically but maybe I need to write a custom :remote
spec in my read
method.
Not sure how I'll get at the props for the email though. The env
doesn't contain that, and props
is nil
.
(defmethod read :email/by-uuid
[{:keys [query state ast] :as env} k props]
(let [st @state]
{;; :value (om/db->tree query (get st (:key ast)) st)
:value (get-in st k)
;; :remote (update-in ast [:query] #(into [] (remove om.util/ident?) %))
:remote true}))
one thing to notice, the pure Om.next way of handling data loading is tricky IMO
trying to make diffs and having to put markers on the parser
had you considered trying #fulcro?
Defeat in the sense that I'm giving up on solving the problem myself. It feels to me a bit like looking at the answers section at the back of a puzzle book.
fulcro is the new untangled name π
data fetching there is much easier
because it's explicit
no, different people
I highly recommend trying it, dealing with pure Om.next is like trying to write a web-app without any framework, Om.next is more like building blocks then a ready-to-use library
Not sure why that is defeat π