Fork me on GitHub
#om
<
2016-08-31
>
ethangracer15:08:23

does om have any kind of caching story for denormalization?

anmonteiro15:08:54

@ethangracer you can memoize db->tree

ethangracer15:08:40

@anmonteiro cool thought, thanks

levitanong16:08:07

Hello, om.next idiom question here. I’m trying to pass a UI state (stored in app-state, like :current-tab, or something) to a component (let’s say Student). As I understand it, I probably shouldn’t place :current-tab in Student’s query, as it isn’t a part of Student-ness. It’ll probably mess up the normalization, etc… So my question is, where is the appropriate place to put it? My guess is via computed. i.e.

(student-view (om/computed student-props {:current-tab current-tab}))
The above works fine for me (so far), so I guess I’d like to know if my approach is idiomatic, and if it isn’t, what is the correct way?

anmonteiro16:08:56

Component render functions shouldn’t be worried about the data that its child component needs

anmonteiro16:08:04

only the parser should worry about that

anmonteiro16:08:20

calling db->tree on a query that has a link will resolve the link and include it properly

levitanong16:08:38

@anmonteiro Thanks! Will take some time to read this.

ethangracer17:08:29

@anmonteiro the issue that I thought had to do with denormalization actually has to do with path-meta. it is increasing my runtime by 50% for recursive reads

ethangracer17:08:47

I can send a cpuprofile if you’re interested

anmonteiro17:08:31

@ethangracer hrm path-meta will always have to walk your data structure to tag it with the appropriate path

ethangracer17:08:59

so that om can index?

ethangracer17:08:16

not sure I understand, if I’m generating props why do I need all that metadata

anmonteiro17:08:30

full-queries, indexing, etc

ethangracer17:08:05

wondering if it’s possible to reimplement path-meta as a tail recursive call but it doesn’t look too promising

anmonteiro17:08:43

@ethangracer path is also a big part in incremental rendering, btw

ethangracer17:08:53

So the om components depend on meta data in the props to help with incremental rendering?

ethangracer17:08:00

I’ll have to try memoizing it, not sure it’s going to make much of a difference though. not seeing a lot of overlapping subproblems, unless i’m missing something