Fork me on GitHub
#untangled
<
2016-12-14
>
tony.kay19:12:53

We're needing to use SQL databases with our Untangled/Om apps. I just wrote a proof-of-concept for converting SQL table results to tree responses if anyone is interested. I developed it in a devcard with text explanations and example data/output here: https://github.com/awkay/table-to-tree

tony.kay19:12:44

It is a somewhat inefficient implementation (I was shooting for clarity). I expect we'll develop a more efficient version soon, and probably include it as a utility function in untangled-server

gardnervickers20:12:51

Is the entire component’s query used as a key in app state for the data fetch indicator?

tony.kay20:12:48

no. the data fetch indicator is placed based on the target of the result being loaded

tony.kay20:12:28

so, for example, if using load-field the fetch indicator is placed where the field would go

tony.kay20:12:06

if using load-data it is placed at :target, I believe, or at the top-level key of the first item in the query if no target is specified, I think

tony.kay20:12:56

The original idea (from a while back on the original API) was that load would be used on a query with a single top-level join...and that is where the data (and indicator) were placed.

tony.kay20:12:30

The newer API recognizes some additional patterns. I think the load markers have been updated to work properly with them, but I cannot promise I didn't introduce a bug on them.

gardnervickers20:12:35

With all data loads disabled, I’m running into an instance where members of a union have their entire queries and subqueries as keys in the app state, the value to that key is

{:ui/fetch-state
    {:untangled.client.impl.data-fetch/type :not-found}}

gardnervickers20:12:08

I’ll try and make a devcard

gardnervickers20:12:39

Here’s a screenshot of the devcard state

gardnervickers21:12:00

This shows up in the cookbook example too

gardnervickers21:12:42

I’ve tried with both 0.6.0 and 0.6.0-SNAPSHOT. I’ll try to bisect and find where this started, I don’t remember it being an issue before.

tony.kay21:12:10

@gardnervickers Thanks for the effort. This used to work for you?

gardnervickers21:12:38

I don’t remember seeing it before, mostly it’s hindered our ability to easily debug app state issues.

tony.kay21:12:57

oh, you're saying it doesn't break things, just leaves litter?

gardnervickers21:12:55

Heh I’m not sure yet, I just switched back to working on our Untangled Client app to debug some issues that were temporarily solved by forcing a full page render.

gardnervickers21:12:32

I was attempting to debug those problems and found it pretty difficult with this extra query information hanging around.

tony.kay21:12:33

That looks pretty bizzare. The entry in that map is vector-as-a-key. That doesn't make any sense

tony.kay21:12:56

and it isn't query information. It's a load marker.

gardnervickers21:12:58

Yea, possibly a problem when constructing initial-state from the top level union?

tony.kay21:12:10

but it also looks borked in other ways

tony.kay21:12:54

Yeah, it must be initial app state

gardnervickers21:12:07

I would expect that if I was running a query, but at the ident right?

gardnervickers21:12:16

Or, keyed by the ident

tony.kay21:12:53

what is your load look like, and what is the response?

tony.kay21:12:15

then how the heck are you getting load markers 😕

tony.kay21:12:43

oh....perhaps there's a problem with merge...cause we merge the union stuff into app state

gardnervickers21:12:46

Yea I haven’t seen this happen with anything other than components that are participating in or children of a union.

tony.kay21:12:20

unions are my favorite feature to debug

gardnervickers21:12:47

Haha, we’ve hit nothing but trouble with them.

tony.kay21:12:59

they're the right solution to the problem. Just a little hard to write algorithms around

tony.kay21:12:02

in the internals

tony.kay21:12:23

go ahead and report an issue

tony.kay21:12:30

link to that example gist

tony.kay21:12:36

I'll see what I can find

tony.kay21:12:59

that line in plumbing is obviously the issue, I'm just not sure why it is even involved

gardnervickers21:12:56

Out of curiosity, do you guys at Navis build page switching into your Untangled App?

tony.kay21:12:09

page switching?

tony.kay21:12:16

you mean do we using unions?

gardnervickers21:12:16

Tabbed navigation?

tony.kay21:12:29

yes, but we don't do much with html5 routing around it (yet)

tony.kay21:12:42

it is simple enough to hook up, though

tony.kay21:12:54

just map URL segments to ident swaps

gardnervickers21:12:01

Yea we’ve been doing alright with Bidi’s router

gardnervickers21:12:03

Is it possible to work around this somehow by doing the merge ourselves?

tony.kay22:12:08

you could hand-build your app database and not use initial-state, but that sucks

gardnervickers22:12:27

Yea our app is way too big for that at this point.

gardnervickers22:12:31

Ehh postwalk to remove nils when printing works well enough I guess

tony.kay22:12:55

remove nils???

tony.kay22:12:01

nothing you showed me had nils

gardnervickers22:12:48

Oops I mean the load marker

tony.kay23:12:36

@gardnervickers well, when I change that line of code in mark-missing to put in the proper marker your example works correctly, but 4 tests fail in our spec. I'll have to see if the tests were mis-written, or if there is an additional case that was covering and more detail is needed in the mark phase

gardnervickers23:12:58

Fantastic thanks for your help on this

tony.kay23:12:10

could be is was written one way, something changed, and the tests were passing for bad reasons