Fork me on GitHub
#untangled
<
2017-04-09
>
eric.shao03:04:22

Please give an answer of the “untangled-devguide.E-UI-Queries-and-State-Exercises”. ( With the graph-db already set,how will you chain the total-query with an intermediate ui-component without the query-expression.)

cjmurphy04:04:34

@eric.shao: Would using get-query help? (sorry haven't looked at the exercises) - that's how you use the query of another component.

eric.shao04:04:27

@cjmurphy thank you for rpl. yes, I want to use ’get-query to chain them throuth.but … (components structure: Root->PeopleWidget->Person)(db-structure: db-map -> :widget ->:people ->person) (query-structure: Root -> Person)

tony.kay04:04:19

@codxse I didn’t realize I had put that anywhere publicly visible 😕

tony.kay04:04:52

crap…totally my bad

codxse04:04:58

no problem

tony.kay04:04:59

I’m going to back that out

tony.kay04:04:31

@eric.shao I think on that one there is a component that has no state…and as far as “stateless” components go, you just don’t involve them in the query, and they can pass props through unchanged. In other words, they’re sort of invisible. You’d compose the query of the child up to the stateful parent. It isn’t the best example, and I should update the exercises. It is really rare that a component would be involved like that and have zero state.

tony.kay04:04:44

that’s why there is no TODO in the middle one

tony.kay04:04:35

hm..that may not be right. It’s been a long time since I wrote that exercise. I’d have to pull the source and do it…and at that point I should probably just rewrite it

tony.kay04:04:34

Not a bad idea to use the youtube videos. They are a bit more up to date. They are short segments (like 20 mins each) and most ppl find them quite useful.

eric.shao04:04:33

[:new-person :last-error {:widget [{:people (om/get-query Person)}]}] two-levels-join donesn’t work,right?

eric.shao04:04:42

I am not a english-native, so the text-tutorial is more clear for me.😀

cjmurphy05:04:15

[:new-person :last-error {:people (om/get-query Person)}] - just one vector on the outside. See the Kanban demo for all of this kind of Om.Next stuff put together.

cjmurphy05:04:06

https://github.com/Jannis/om-next-kanban-demo - is very good for just reading code for a real application, that includes CSS etc. <<- @eric.shao

eric.shao05:04:56

@cjmurphy but the db-structure is : db-map -> ‘:widget’ ->:people ->person)

cjmurphy05:04:53

The two (or more) levels join happens by composition, so [:new-person :last-error {:widget (om/get-query Widget)}]. And then the Widget component might have the query [{:people (om/get-query Person)}]

tony.kay06:04:01

What @cjmurphy said. I think the exercise is not so great. Putting a query on the middle component does make it match up better. You’d never structure a real app the way the guide is asking you to.

eric.shao16:04:32

@cjmurphy @tony.kay Thank you very much!😄