Fork me on GitHub
#om
<
2015-12-31
>
smeister07:12:41

@adammiller thanks, i already got it working.

deplect14:12:18

process roots will drop all other query fragments and will return only the deepest one. Is this intended?

dnolen17:12:55

@deplect: er that seems weird and I thought we had tests for that, @tony.kay might know something about that as well

tony.kay17:12:42

@deplect: you cannot have subroots...am I reading that right?

deplect17:12:20

I was just experimenting with process-roots as I assumed it would keep the rest of the "tree" intact and move only the nodes tagged with query-root to the root, but I noticed that the resulting query is just the deepest node tagged with query-root effectively removing all other "nodes", also useful but not in my case.

tony.kay17:12:17

process-roots is about removing the client UI-local parts of the query, so you can send just the bits to the server...but it is about prefix removal...thus the name.

deplect17:12:25

I moved to the latest version of om.next as i was on alpha28 and saw an issue regarding this. Now I am a little confused about the intended behaviour ..

tony.kay17:12:26

you have a tree, after all

tony.kay17:12:53

think about REST-style routes: /questions, /questions/1, /questions/1/comments

tony.kay17:12:33

in Om, you have more expressiveness, but you also typically tack in UI stuff in front, so yuour effective paths from root contain cruft the server need not know about

tony.kay17:12:49

/myui/widget/panel/questions/1

deplect17:12:20

I understand the principle and what is accomplished using the parsing principle. I've read all your documentation, great source of information btw simple_smile

tony.kay17:12:21

process-roots is about removing the prefix...but from a tree that has an arbitrary branching factor

tony.kay17:12:16

subroots make no sense, since once you've found a root, the remainder of the query is, well, the query you want to send to the server

tony.kay17:12:15

siblings are fine

tony.kay17:12:34

even sub-roots from different siblings at different depths

tony.kay17:12:57

there are open issues/PRs for handling a few extra cases, like unions...but the behavior needs a bit more care there

tony.kay18:12:25

I should definitely write up more docs simple_smile

deplect18:12:06

yes the case I am developing is multiple remote "fragments" placed at various depth in the tree, which I want to collect and send as part of the full-query on root level, on receiving the server response rebuild the tree. I was probably hoping process-roots was something like that simple_smile

dnolen18:12:35

@tony.kay: I’m less concerned about the misunderstanding here then the fact that the deepest query root getting lifted

dnolen18:12:48

instead of just ignoring subroots

tony.kay18:12:32

@dnolen: The assumption is you're wanting to remove a prefix. The choice could go in either direction (remove the least or most). I'd have to reconstruct my thinking to say why I went the way I did.

dnolen18:12:07

@tony.kay: the current behavior just seems undesirable to me

dnolen18:12:20

at least from a concurrency standpoint where you may delay remoting

dnolen18:12:43

and a query root higher up may get merged in

tony.kay18:12:23

so, you're indicating a case where I may queue up more than one call to send somehow, then merge them for a single network op later?

dnolen18:12:34

yes send is completely opaque

dnolen18:12:43

people should be able to do whatever they want/need behind it

dnolen18:12:59

that said this isn’t super high piority

dnolen18:12:09

process-roots is just a helper after all

tony.kay18:12:01

I'll see if I can (re)construct an argument for the behavior. I wrote it down somewhere...I did a lot of thought on this one.

tony.kay18:12:41

I also agree that it is just a helper, and ppl can easily copy the current function and tweak it to their needs even

tony.kay18:12:21

hm, actually, there is a test indicating the subroots are ignored in the fashion opposite of what @deplect is reporting...

dnolen18:12:32

yeah that’s what I thought simple_smile

tony.kay18:12:50

I refactored those tests at one point, and may have broken it to give a false positive 😞

dnolen18:12:32

again low priority for me until Beta when we should switch gears to focus on polishing

tony.kay18:12:26

yep...reading the test, it looks right actually

tony.kay18:12:57

I'll send a note to myself to try out the case specifically

tony.kay18:12:26

Eventually also need to re-visit this with respect to parameters and unions...the two open PRs get us really close

dnolen18:12:37

yep I saw those - will look at them when I’m out of the weeds with error handling

tony.kay18:12:01

need any help?

tony.kay18:12:20

If I get some time, I could sort through some of the issues, if you could point me to ones you'd like to hand off

dnolen18:12:16

not yet but maybe later

dnolen18:12:39

it will definitely need testing in projects and likely adjustment based on that

tony.kay18:12:31

oh, I meant Github Issues

dnolen18:12:41

hrm #555 maybe

dnolen18:12:53

#550 need more information - like a some kind of suggestion about a solution

dnolen18:12:11

the rest I will need to sort through myself at least to understand what they are actually about

dnolen18:12:15

when I have time

tony.kay18:12:46

Already made a PR for 555

tony.kay18:12:53

I can play with 550

dnolen18:12:36

@tony.kay: oh missed the PR - merged

tony.kay18:12:59

that was right, then, I guess simple_smile

tony.kay18:12:20

I wasn't sure I completely understood the zipper structure

dnolen18:12:10

another thing on the Beta list of todos, documentation on architecture for contributors

dnolen18:12:17

graffles would be helpful here

dnolen18:12:44

how it works is far more boring than people might imagine simple_smile

tony.kay18:12:39

I get most of it...the "to many" case was the bit I don't follow: how you figure out which thing in the list gets which query

dandorman18:12:16

sorry to intrude with a newbie question: I’m working through the last part of the Remote Synchronization tutorial (the Wikipedia autocomplete), and I keep getting an undefined function error for om/query->ast. Any ideas where I could look?

dnolen18:12:51

@dandorman: did you copy and paste the code or are you trying to type it in?

dandorman18:12:06

the latter; helps to solidify the concepts simple_smile

dnolen18:12:10

@tony.kay: like the “to many” case of joins or unions?

dandorman18:12:18

however, now that I’ve done it, I’ll just copy and paste and try that; thanks

tony.kay18:12:48

@dnolen: don't sweat it...I don't have the brainpower to deal with that right now...kinda busy...so I don't want to use your time on it simple_smile

dandorman19:12:19

well, I was initially hitting the problem after copy/pasting too; but with sufficient refreshes, clearing out the build directory, and inspecting the om.next source in Chrome’s dev tools (?), eventually om/query->ast became a thing

dandorman19:12:26

gonna chalk it up to weirdness in my local env

dandorman19:12:03

another problem was that I couldn’t get the controlled version of the search field to update its value

dandorman19:12:23

but by commenting out the :value query line, the rest of the flow basically worked

dandorman19:12:57

it’s as though om/set-query! was not enough to trigger a re-render