Fork me on GitHub
#om
<
2016-02-19
>
bones03:02:25

What鈥檚 the deal with animation? Is it a react concern; something we handle via lifecycle hooks?

drcode05:02:06

react-motion is pretty awesome and works well with om next

drcode05:02:24

I recommend watching the video on that site

drcode05:02:07

Clearly, this doesn't handle all animation concerns, but it handles about 80% of them, and does so in a way that is declarative and doesn't muck up your components/state/etc

marianoguerra08:02:37

@anmonteiro: hi! one question, how do you develop/test/play with om.next, do you do changes in a project and lein install and use the snapshot?

marianoguerra08:02:11

@cjmurphy: thanks!, the thing is that I'm trying to get tempid migration to work on an example I'm building, so I would like to add some debugging to the om.next side to know what expects

marianoguerra08:02:31

this means I need to change it and the changes be reflected in my project

marianoguerra08:02:58

the only thing I can think right now is to do the change, lein install, and restart figwheel, but that's slow 馃槙

marianoguerra08:02:53

I may just do the actual question: what is the format of the response from the remote so that the tempids parameter on migrate has the mappings I'm returning

cjmurphy08:02:54

That's probably what I would be doing if needed to. No too slow is it??

marianoguerra08:02:35

I tried :value {:tempids {...}} :value {...} {:db/id {...}}

cjmurphy08:02:13

No idea on remotes from me sorry 馃槥

marianoguerra08:02:39

@danielstockton: I started there and I'm using the code in code.cljs but in the simulated server he seems to return {:tempids {...}} which doesn't work for me

danielstockton08:02:24

Whatever you return from :action will be under a :result key in the response, I think.

anmonteiro09:02:51

@marianoguerra: you should return the tempids in :value {:tempids {}}

marianoguerra09:02:41

if that's in a mutate the frontend will see something like {:tudu.item/create {:tempids []}} right?

marianoguerra09:02:01

shouldn't it be a map and not a vector?

marianoguerra09:02:34

I wasn't recompiling between stop/start 馃槙

marianoguerra09:02:31

tempid migration working on tudu example simple_smile

bones09:02:02

@drcode: awesome, thanks

bones09:02:43

Why, in the Normalization tutorial must you normalise from the RootView? Why can't you normalise using the Person component - it's the one with the actual Ident?

iwankaramazow10:02:45

@bones: the RootView-component is rigged to the reconciler. The reconciler checks the query of the component you add trough add-root

iwankaramazow10:02:04

Keep in mind Person is a strange query

iwankaramazow10:02:21

the query only asks for some properties

seanirby10:02:44

bones: are you trying to see the normalization through om/tree->db ?

iwankaramazow10:02:49

it does make more sense of asking for those properties in the context of a list

bones10:02:53

But if I'm just doing om/tree->db to see what normalisation looks like, why do I need anything but the component with the Ident?

bones10:02:24

@seanirby: yip, that's the one

iwankaramazow10:02:53

@bones: RootView just adds :list/one to the query

iwankaramazow10:02:12

normalization doesn't make much sense without some sort of list

iwankaramazow10:02:24

think about it

iwankaramazow10:02:37

if you look at Person, those are just properties

iwankaramazow10:02:49

'[:name :points :age]

seanirby10:02:34

If I understand correctly if you pass the Person query to tree->db then it will look at persons query against the data you give it, that doesn't make sense because Person doesn't query anything in the top level of that data, RootView does

seanirby10:02:28

*if you pass the Person component

iwankaramazow10:02:28

only the top level keys get interpreted by your parser

seanirby10:02:41

that was what i meant, you give queries to db->tree

iwankaramazow10:02:42

in this case this is :list/one and :list/two

bones10:02:18

Oh, so tree->db uses the parser somehow when normalising?

bones10:02:49

I was thinking it would just grab whatever Ident was on an component you fed it and normalise the data like that

bones10:02:12

But looking at it now, it RootView doesn't have an Ident so it can't have worked that way

iwankaramazow10:02:07

@bones: the reconciler knows RootView has a path to Person, internally it knows when resolving that path it needs to keep the ident of Person in mind

iwankaramazow10:02:29

think in terms of links

iwankaramazow10:02:41

(om/get-query) links your components

bones10:02:14

Yip, the RootView uses Person to construct it's query

danielstockton10:02:15

When you change the app-state with set-query, are these stored in some other part of the reconciler to what you pass in as app-state?

seanirby10:02:37

bones: i recommend checking out "awkway"'s tutorials on github. I think they're much clearer

seanirby10:02:00

jeeze i can't type tonight

bones10:02:03

@seanirby: I flipping between awakes and the normalisation one

seanirby10:02:37

bones: nice

bones10:02:48

@seanirby @iwankaramazow thanks for your help - just going through the source for tree->db

seanirby10:02:24

bones: NP. Glad I could help simple_smile

iwankaramazow10:02:31

indeed NP 馃槃

marianoguerra11:02:18

@anmonteiro I would like your feedback before proposing a change to om, it's a small optimization, here: https://github.com/omcljs/om/blob/master/src/main/om/next.cljs#L1488

marianoguerra11:02:42

I would like to add a check, if (empty? tempids) then skip the migrate call

marianoguerra11:02:32

it would save a walk through the whole state when there are no tempids to replace

anmonteiro11:02:13

@marianoguerra: I think that's a concern of the migrate function that people implement

marianoguerra11:02:42

yes, I was thinking that option too

marianoguerra11:02:14

ok, added to the todo example

rauh11:02:32

I have a simple ident query and receive {[:login/show :main] :login} as props, however once it re-renders I receive it in the form of {:login/show {:main :login}} messing up my render function. Any ideas?

jannis12:02:34

@rauh: https://github.com/omcljs/om/blob/master/src/main/om/next/impl/parser.cljc#L20 - sounds like what you want may be {[:login/show :main] [:login]} (assuming you want the :login prop of the data that [:login/show :main] refers to)?

jannis12:02:07

Oh, sorry {[:login/show :main] :login} is not the query.

jannis12:02:48

Ignore what I wrote then.

rauh12:02:49

My query is [[:login/show :main]], an ident

jannis12:02:21

Yeah, that makes sense. Sounds like a bug.

rauh12:02:02

I'll try to make a minimal example

george.w.singer12:02:02

Random question: does a call to (om.next/class->any reconciler SomeClass) generate a n anonymous instance of a component SomeClass on the fly, or does it return an actual, matching instance in your application?

a.espolov12:02:47

Guys how to create ui tree on om.next, example: 1. remote read method for :xyz returned list - is 1 lvl from ui tree 2. click on tree node call remote read method for :xyz/item by unique key returned 2 lvl from ui tree ?

anmonteiro13:02:41

@dnolen: I've given a bit more thought to the query/"routing" stuff in conjunction with @tony.kay and, without writing any code, here's what I've drafted as something that could work: Restricting set-query! to the following: 1) only allow setting an instance query if - a) the instance has a ref (so that it can be used with subquery later) - b) there's only one instance of this class in its data-path (which I believe is preferrable over classpath) - c) if none of the above, we interpret it as setting the class's query (the case where we want to change the query of all posts - leaves of the UI tree - in a dashboard) 2) Modify get-query to work with the new semantics of set-query when working with instances 3) build-index will be fixed for free because it just uses get-query on the root 4) full-query also fixed for free because it uses the indexes

dnolen13:02:35

@anmonteiro: sounds interesting, can you please make a Om wiki idea page summarizing these thoughts, I can weigh in on it later today

dnolen13:02:00

thanks much

danielstockton14:02:46

where does the reconciler store state like query params?

danielstockton14:02:35

what if i use datascript? does it know how to store it?

danielstockton14:02:03

i presume not, in which case, are there some hooks for that?

anmonteiro14:02:43

Don't think there are any hooks

danielstockton14:02:02

i probably have to work this out in my merge function right?

anmonteiro14:02:20

It's a good time to bring up these things regarding queries though

danielstockton14:02:25

havent worked with many queries until now and just had this thought when reading they change the app state

danielstockton14:02:45

do you know where in the code this gets handled for the usual atom-based app-state?

anmonteiro14:02:22

Params are only stored in app-state when you changed them at runtim

anmonteiro14:02:39

if you set normal query params they'll be stored in the class

anmonteiro14:02:48

I'm assuming you knew this, but just for completion

anmonteiro14:02:02

yes, that bit

danielstockton14:02:15

yeah, i assumed it was only when calling set-query

grzm14:02:06

@marianoguerra: glad to see you got the tempid stuff figured out for tudu . I've tried it out and can confirm that the errors I saw yesterday are no longer there.

grzm14:02:42

This whole editing messages thing in slack still amazes me.

danielstockton14:02:20

@anmonteiro: This looks like the other place it boils down to. I guess we'd need a more generic way of reading/writing the query

danielstockton14:02:12

:save-queries and :load-queries on the reconciler perhaps?

anmonteiro14:02:28

which other place?

danielstockton14:02:26

I could perhaps work on a PR for this, if it seems like a sensible thing? @dnolen?

anmonteiro14:02:40

I'd be more inclined to a protocol just like ILocalState

anmonteiro14:02:00

it's ultimately David's decision though

dnolen14:02:06

@danielstockton: this is not something I鈥檓 interested in yet

danielstockton14:02:58

Ok, I'll wait till the other work on queries settles a bit

anmonteiro14:02:35

@danielstockton: seems like a sensible decision to me. These things around set & get query might change in the near future

anmonteiro14:02:10

a protocol might actually not make sense because you'd need to implement it in every component, thought macros could take care of that. Just thinking out loud

danielstockton14:02:19

I thought it was similar to some other hooks that are stored on the reconciler. If om philosophy is to put everything in a single state store, doesn't seem useful to be able to define it per component. But might be wrong?

anmonteiro14:02:08

no you might be right

jlongster15:02:06

@dnolen: I opened a PR yesterday to revert my buggy change, in case you haven't seen it. not sure how many people work off of master, but if many do might be good to merge it

dnolen15:02:46

@jlongster: thanks for fixing that and the bump - merged

jlongster15:02:09

np. will think about it more at some point but my queries are running fast enough for now

futuro21:02:11

Let's say I have a Parent component and a Child component, and Parent's query is [:someread {:parent (om/get-query Child)}], when my app state updates, and it's relevant to the child but not the parent, does the reconciler rerun the read with the query defined by the parent, or just the Child components query?

danielstockton21:02:29

@futuro: you transact on a component, which will re-render that component and any other reads you pass at the end of a transaction

danielstockton21:02:13

so it depends on the component you transact and the keys you pass to be re-read (om can't work out exactly what you need to re-read, this can be different for each mutation)

futuro21:02:26

thank you simple_smile

anmonteiro21:02:42

@dnolen: FWIW, I have an initial version of what's detailed in the design document working that seems to be solving the issue

anmonteiro21:02:08

i.e. child components correctly indexed when changing a child query

anmonteiro21:02:17

pretty exciting

anmonteiro21:02:55

though there's the need to store queries in the component class, which I'm not sure you're going to be a fan of

anmonteiro21:02:20

because we don't have the reconciler available when getting an updated query for the class

dnolen21:02:39

@anmonteiro: seems like there would be a way to thread that through

anmonteiro21:02:15

@dnolen: I don't know what you mean by that

dnolen21:02:04

@anmonteiro: isn鈥檛 there some solution that permits the reconciler being available?

dnolen21:02:19

or indexer

anmonteiro21:02:45

@dnolen: could we store the reconciler in the component class? I'm also thinking that's not a good thing

dnolen21:02:25

not suggesting that, haven鈥檛 seen any code yet so I鈥檓 talking without any real knowledge about your approach

anmonteiro21:02:32

I understand

dnolen21:02:35

but I would avoid storing anything on the class if possible

anmonteiro21:02:53

I imagined that would be the case

dnolen21:02:09

it鈥檚 just a modularity problem

dnolen21:02:15

i.e. multiple reconcilers stuff like that

anmonteiro21:02:52

the reason why I chose to store the query in the class is because we allow queries to change in a class-wise fashion

anmonteiro21:02:28

i.e. what I exposed to you yesterday ("should we allow all the posts in a Dashboard to change their query?")

anmonteiro21:02:47

if we omit this requirement we just don't need to do it at all

dnolen21:02:09

I understand the rationale, just saying don鈥檛 use the class itself as the index

dnolen21:02:31

make data structure for that and put it somewhere

anmonteiro21:02:54

somewhere being?

dnolen21:02:06

ideally the indexer

dnolen21:02:13

since it鈥檚 already managing similar relationships

anmonteiro21:02:26

my problem is that we don't have access to the reconciler.. or the indexer

dnolen21:02:41

right but I don鈥檛 understand how that is possible

anmonteiro21:02:45

because as we (get-query Class) from the root

anmonteiro21:02:55

we need to see the updated stuff

dnolen21:02:24

there鈥檚 nothing async here, you can always opt to use dynamic binding

anmonteiro21:02:16

currently there's a binding being set up in the render method

anmonteiro21:02:28

for *reconciler*

anmonteiro21:02:48

But I don't think that's available

dnolen21:02:09

right but why can't you set this up yourself for where you need it is all I鈥檓 saying

anmonteiro21:02:59

That's good feedback, I'll circle back and try to incorporate it

anmonteiro21:02:38

I'm thinking that we could probably set the binding in set-query!

anmonteiro23:02:03

@dnolen: I might still be making wrong assumptions about this problem which is complecting the solution. The fundamental question that I have now is: Should we see the runtime query structure when we (get-query RootClass), or only when we (get-query RootInstance)? I think I keep trying to support both and this will eventually lead me nowhere

anmonteiro23:02:27

although even when we get-query of the root instance, it will still have calls to get-query of classes inside, which I think obviates the need to support both

dnolen23:02:14

@anmonteiro: ah no you want need to be able switch to the right thing

dnolen23:02:30

(get-query X) where X is a variable thing somehow

anmonteiro23:02:18

that's where I'm currently blocked

anmonteiro23:02:56

which might lead me to tinker with the query manager thing again