Fork me on GitHub
#untangled
<
2016-05-01
>
currentoor04:05:33

@dimiter: I believe untangled by design avoids using query params from UI components.

currentoor04:05:00

instead this sort of thing is accomplished via transactions into app-state

vmarcinko04:05:37

@mahinshaw: Thanx for suggestion, but there are cases when some "entitiy" has some fields which are only generated on server, and I don't speak about IDs only, so client cannot guess what they are because they are not entered via some client input form, so in that case to get complete entity presented on UI, the only way is to wait for server to return this entity representation, whether in HTTP response of mutation operation or in subsequent reload operation, no?

kauko13:05:56

I'm working through the Untangled tutorial (pretty good so far), and I noticed that the query editors don't work properly. I have to refresh the page to get my new query to load

kauko14:05:02

ohh nevermind, I didn't realise I'm supposed to use the editor in the browser

kauko14:05:06

I was using it through code

kauko14:05:07

in part E "UI Query and Exercises" the exercise has me add an ident to a component. I don't think this has been explained in the tutorial yet.

kauko14:05:26

The tutorial has mentioned idents lots of times, but nothing about attaching them to components or what that means

kauko14:05:22

Solutions are not available either

kauko14:05:36

Alright, I've no idea what I'm supposed to do. Anyone have a moment to help me out?

;; TODO: Add root query. Remember to include top-level properties and compose in PeopleWidget
  static om/IQuery
  (query [this] `[:widget {:people ~(om/get-query Person)}])

kauko15:05:58

This is what I have right now:

(defui Person
  ;; TODO: Add a query for :db/id, :person/name, and a recursive access of :person/mate
  ;; TODO: Add an ident that uses :db/id
  static om/IQuery
  (query [this] '[:person/name {:person/mate [:person/name]}])
  static om/Ident
  (ident [this {:keys [id]}] [:db/id id])

(defui Root
  ;; TODO: Add root query. Remember to include top-level properties and compose in PeopleWidget
  static om/IQuery
  (query [this] `[{:db/id ~(om/get-query Person)}
                  :widget
                  :new-person
                  :last-error])
And nothing new on PeopleWidget.

kauko15:05:50

I don't really understand what "compose in PeopleWidget" means. If anyone could point me in the right direction, I'd appreciate it simple_smile

currentoor18:05:33

@kauko: you are asking the right questions but keep in mind this stuff is probably going to take some time to sink in. Om.next is not one of those build a toy app in an afternoon type frameworks.

currentoor18:05:16

I suggest you slow down and make sure you understand each piece before moving on to the next.

currentoor18:05:55

What do you think an ident is?

kauko18:05:56

Isn't it pretty much just an id?

currentoor18:05:20

Have you worked with datomic at all?

currentoor18:05:13

I like to think of it as a table name + id

currentoor18:05:59

Do you understand what the tutorial means when it talks about the app state having tables?

kauko18:05:10

I think I do

currentoor18:05:33

So the next thing I think is to understand is that om requires your UI components to match your app state tables

currentoor18:05:18

This includes queries, hierarchy and ids

kauko18:05:43

alright..

currentoor18:05:14

an example might help

currentoor18:05:25

say you have a person table

{:person/by-id {1 {:person/id 1  :person/name “bob”}}

currentoor18:05:43

in your app state

currentoor18:05:33

in your UI when you want to render a person entity the query could be [:person/name]

currentoor18:05:48

and the ident would be [:person/by-id 1] for bob

currentoor18:05:01

so basically if you have a component that describes a particular entity in app state, for example a form for editing persons, then the ident tells you which particular entity in app state the component represents

kauko18:05:25

Yes, this is one thing that I think I understand 😛

currentoor18:05:51

cool, so what doesn’t make sense about idents then?

kauko18:05:34

Oh, the ident part was mostly about defining it for the component, since that was the first time the tutorial mentioned such a thing. Feedback, you know?

kauko18:05:15

Although I don't know if I did it correctly. Can't get my solution to work simple_smile

currentoor18:05:16

which TODO is causing trouble?

kauko18:05:34

just a sec, let me get my laptop