untangled

NEW CHANNEL: #fulcro
tony.kay 2016-09-28T17:00:40.001382Z

I seem to have gotten the travis CI build of U.C. working better. I reduced the memory footprint of the JVM instances and made sure all of the versions of things used to run the automated tests were up to date, and that hopefully has solved the erratic failures on running the browser that runs the tests.

1👍
2016-09-28T21:09:35.001392Z

It’s looking to me like load-data is deleting fields on subsequent queries with fewer keywords. e.g. if I first call (load-data [:several :keys {:with [:some :joins]}]), and later I call (load-data [:several :keys]), then the data under the :with key is gone. has anyone else seen the same behavior?

2016-09-28T21:10:27.001393Z

doesn’t seem appropriate to me since I might want to update the data at :several and :keys but not another key

tony.kay 2016-09-28T21:18:56.001394Z

mmmm...I would be very surprised if that is the case

tony.kay 2016-09-28T21:19:05.001395Z

there is no memory of the prior

tony.kay 2016-09-28T21:20:03.001396Z

I have a feeling you've got some other bug...perhaps in a post mutation?

2016-09-28T21:27:33.001399Z

@tony.kay thought it might be a post-mutation but I’m sure it isn't

2016-09-28T21:28:12.001400Z

it definitely could be some other bug

2016-09-28T21:28:38.001401Z

but the data for all fields not specified in the second load is gone

tony.kay 2016-09-28T21:28:54.001402Z

do they have some similar root?

tony.kay 2016-09-28T21:29:13.001403Z

are you using get-query so the normalization will work?

tony.kay 2016-09-28T21:29:26.001404Z

what else are you not including in your description?

2016-09-28T21:30:15.001405Z

yes to using get-query

2016-09-28T21:30:22.001406Z

not sure what you mean by similar root

tony.kay 2016-09-28T21:30:34.001407Z

is an ident involved?

2016-09-28T21:30:36.001408Z

I don’t think I’m excluding anything relevant

2016-09-28T21:30:42.001409Z

yes, normalization is involved

tony.kay 2016-09-28T21:30:54.001410Z

not the same

2016-09-28T21:31:15.001411Z

I have a survey that is already normalized in app-state

2016-09-28T21:31:41.001412Z

then i’m pulling down a survey request, which itself pulls down certain details about that survey

2016-09-28T21:32:25.001413Z

the already normalized survey data is a superset of the survey data pulled down with the request

2016-09-28T21:32:44.001414Z

but all of that survey data uses the same ident, because both refer to the same survey

2016-09-28T21:33:32.001416Z

by the time the post-mutation runs, the data is already incorrect

tony.kay 2016-09-28T21:34:11.001417Z

ah, so you're saying the merge is stomping on the object

2016-09-28T21:34:17.001418Z

seems that way

tony.kay 2016-09-28T21:34:21.001419Z

instead of recursively merging into it

2016-09-28T21:34:24.001420Z

yes

2016-09-28T21:34:32.001421Z

that’s my running hypothesis

2016-09-28T21:34:40.001422Z

having a hard time tracking it down

tony.kay 2016-09-28T21:35:09.001423Z

merge-idents is a separate step in the low level Om merge. I'm trying to remember if we override that or just the general data merge

tony.kay 2016-09-28T21:35:25.001424Z

oh, but you're using load-data, so there isn't a rooted ident in the query

2016-09-28T21:35:33.001425Z

correct

tony.kay 2016-09-28T21:35:44.001426Z

it is possible it is a bug in the sweep merge

tony.kay 2016-09-28T21:35:58.001427Z

which , of course, is the most complicated bit of code in untangled

2016-09-28T21:36:13.001428Z

aaah, that would make a lot of sense

tony.kay 2016-09-28T21:36:15.001429Z

it has a set of tests...you might beef them up and see if you uncover badness

2016-09-28T21:36:21.001430Z

if it marks keys as missing

tony.kay 2016-09-28T21:36:27.001431Z

do you remember the basics of the algorithm?

2016-09-28T21:36:39.001432Z

I’m not sure I ever bothered to learn it 😬

2016-09-28T21:36:46.001433Z

I probably should

tony.kay 2016-09-28T21:38:15.001434Z

well, it is a bit involved...here is the basic idea: 1. It uses the query AND the result 2. It follows both through the recursive logic or the query and structure of the data 3. If something is asked for in Q and not in R, then it is marked as missing 4. It if is asked for in Q and IS in R, it should pick the proper merge (or recursive step)

tony.kay 2016-09-28T21:38:56.001435Z

Then after the merge runs, a sweep step removes everything marked missing

tony.kay 2016-09-28T21:39:38.001436Z

so if you ask [:a {:b [:c]}] with response {:a 1 :b { :c 2} }

tony.kay 2016-09-28T21:40:10.001438Z

it will look at key :a in query while looking for a value in result (1).

tony.kay 2016-09-28T21:40:29.001439Z

then it will look at join on :b while looking at the value in R at :b

tony.kay 2016-09-28T21:40:43.001440Z

of course, T (the target) is involved too

2016-09-28T21:41:03.001441Z

shouldn’t this all happen before looking at the app-state?

2016-09-28T21:41:10.001442Z

and then just do a deep merge?

tony.kay 2016-09-28T21:41:10.001443Z

@adambros wrote the algorithm, so if you find a problem, it might be best to get his help

tony.kay 2016-09-28T21:41:39.001444Z

yeah...I may not be remembering exactly how it works 😜

2016-09-28T21:41:50.001445Z

well I think you’re right

tony.kay 2016-09-28T21:41:52.001446Z

it has to use the query and the result

2016-09-28T21:41:58.001447Z

it is definitely deleting stuff from the app state

2016-09-28T21:42:00.001448Z

but it shouldn’t be

2016-09-28T21:42:05.001449Z

only from the remote result

tony.kay 2016-09-28T21:42:07.001450Z

I designed the algorithm on a white board and Anthony implemented it

2016-09-28T21:42:10.001451Z

haha ok

2016-09-28T21:42:21.001452Z

i’ll take the plunge and see what I can figure out

2016-09-28T21:42:24.001453Z

thanks

tony.kay 2016-09-28T21:42:33.001454Z

welcome. I'd start with tests using your scenario

2016-09-28T21:42:40.001455Z

sounds good to me

adambros 2016-09-28T23:19:05.001458Z

im running into an issue where when i get a 401 i have a network-error-callback that redirects to the logout page but for some reason it gets into an infinite loop when i go to a page that does a load-field BUT i can get out of the loop when i switch to a different tab and it does the logout correctly any ideas?