om

Please ask the channel first, not @dnolen directly!
2017-07-19T12:45:58.618782Z

I think the problem is the om/build-all, try wrapping that in a dom/div.

assassinduke 2017-07-19T12:46:55.642889Z

i am not so sure because i was getting the same error before even adding that part but i will try in a sec

assassinduke 2017-07-19T12:48:55.695013Z

done that same error

2017-07-19T12:51:05.752133Z

What about (dom/p (:first state)), does that not need a second nil argument? I'm sorry, no longer familiar with om.now.

assassinduke 2017-07-19T12:52:09.780948Z

Hmm it may be because i think it tries to make that text a class

assassinduke 2017-07-19T12:52:17.784773Z

let me check

2017-07-19T12:53:39.821305Z

dom functions accept two arguments (attrs and children). Anyway, the error suggests render is returning something bad.

2017-07-19T12:54:21.840590Z

Do you not have a line where the error is raised?

assassinduke 2017-07-19T12:56:52.909550Z

first adding nil doesn't help but i think it shows that there is something really wrong with the code

assassinduke 2017-07-19T12:57:10.917836Z

second no it doesn't specify the line

assassinduke 2017-07-19T12:57:40.932033Z

(about first it gives me an object null)

assassinduke 2017-07-19T13:05:41.176757Z

wow programming at its finest after a restart the object null disapears

πŸ™ƒ 2
jcf 2017-07-19T17:54:07.084257Z

All those idents of [:email/by-id nil] look great when calling cb in my send fn.

jcf 2017-07-19T18:09:57.679381Z

Hmm. I think I may have been normalising things myself right before om.next would normalise, so double normalisation. πŸ™‚

wilkerlucio 2017-07-19T18:19:42.028110Z

@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 πŸ˜…

jcf 2017-07-19T18:20:41.065172Z

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?!

jcf 2017-07-19T18:20:44.067171Z

For real?!!

2017-07-19T18:22:11.120598Z

No @jcf, the second part of the ident.

jcf 2017-07-19T18:22:41.139140Z

Oh, okay! Yeah I've got the data in the page. πŸ™‚

jcf 2017-07-19T18:24:10.194768Z

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.

jcf 2017-07-19T18:24:48.218848Z

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.

jcf 2017-07-19T18:27:42.328413Z

So my query in the detailed view should be {:email/details [:db/id ...]} because idents don't work the way I think they do.

jcf 2017-07-19T18:28:55.374632Z

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.

wilkerlucio 2017-07-19T18:44:26.937870Z

@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"})]

jcf 2017-07-19T18:45:06.961797Z

So to fetch email 123 from the server you'd use IQueryParams?

wilkerlucio 2017-07-19T18:45:18.969476Z

oh, to fetch idents are good actually

wilkerlucio 2017-07-19T18:45:27.974847Z

I was thinking more about mutations

jcf 2017-07-19T18:45:35.979792Z

I haven't gotten that far, yet. πŸ™‚

jcf 2017-07-19T18:46:01.995015Z

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.

wilkerlucio 2017-07-19T18:46:01.995050Z

but you have to parse this on your server-side, aren't you getting the full query there?

jcf 2017-07-19T18:46:16.003605Z

No. The generated query is missing the ident.

jcf 2017-07-19T18:46:56.027070Z

This is what's being sent to the server:

["~:db/id","~:email/body","~:email/sent","~:email/subject","~:email/uuid"]

jcf 2017-07-19T18:47:08.034367Z

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])

jcf 2017-07-19T18:47:44.055938Z

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.

jcf 2017-07-19T18:48:14.073923Z

Not sure how I'll get at the props for the email though. The env doesn't contain that, and props is nil.

jcf 2017-07-19T18:48:26.080686Z

(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}))

wilkerlucio 2017-07-19T18:48:46.092719Z

one thing to notice, the pure Om.next way of handling data loading is tricky IMO

jcf 2017-07-19T18:48:53.097019Z

I'll have to replace true with something like {[:email/by-uuid UUID] (:query ast)}.

wilkerlucio 2017-07-19T18:49:00.100905Z

trying to make diffs and having to put markers on the parser

wilkerlucio 2017-07-19T18:49:14.109553Z

had you considered trying #fulcro?

jcf 2017-07-19T18:49:35.122035Z

No, but I have debated admitting defeat and just using Untangled.

jcf 2017-08-07T16:02:48.681459Z

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.

wilkerlucio 2017-07-19T18:49:48.129712Z

fulcro is the new untangled name πŸ™‚

wilkerlucio 2017-07-19T18:50:01.137428Z

data fetching there is much easier

wilkerlucio 2017-07-19T18:50:07.140950Z

because it's explicit

jcf 2017-07-19T18:50:38.159668Z

I see. That's from the guys who built Boot?

wilkerlucio 2017-07-19T18:50:44.163625Z

no, different people

jcf 2017-07-19T18:50:48.166021Z

No that's Adzerk.

jcf 2017-07-19T18:50:53.168821Z

Something like that anyway. πŸ™‚

jcf 2017-07-19T18:51:38.196759Z

Server-side rendering is on my todo list. Maybe I should use Fulcro instead.

jcf 2017-07-19T18:52:00.209698Z

Evaluating the right JS to get Nashhorn ready to render is tedious at best.

wilkerlucio 2017-07-19T18:52:32.229399Z

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

πŸ‘ 5
jcf 2017-07-19T18:53:29.264116Z

Thanks for the tip, Wilker. I'll take a look.