untangled

NEW CHANNEL: #fulcro
tony.kay 2016-12-14T19:57:53.000295Z

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.kay 2016-12-14T19:58:44.000297Z

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

tony.kay 2016-12-14T19:59:14.000299Z

The card itself is here: https://github.com/awkay/table-to-tree/blob/master/src/cards/untangled_template/intro.cljs

gardnervickers 2016-12-14T20:20:51.000301Z

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

tony.kay 2016-12-14T20:22:48.000302Z

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

tony.kay 2016-12-14T20:23:28.000303Z

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

tony.kay 2016-12-14T20:24:06.000304Z

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.kay 2016-12-14T20:24:56.000305Z

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.kay 2016-12-14T20:25:30.000306Z

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.

gardnervickers 2016-12-14T20:27:35.000307Z

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}}

gardnervickers 2016-12-14T20:28:08.000310Z

I’ll try and make a devcard

gardnervickers 2016-12-14T20:45:37.000311Z

I can recreate it with this https://gist.github.com/gardnervickers/687da840630c07d1e4f9721201a051c3

gardnervickers 2016-12-14T20:46:39.000312Z

Here’s a screenshot of the devcard state

gardnervickers 2016-12-14T21:18:00.000314Z

This shows up in the cookbook example too

gardnervickers 2016-12-14T21:18:42.000315Z

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.kay 2016-12-14T21:30:10.000316Z

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

gardnervickers 2016-12-14T21:30:38.000317Z

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

tony.kay 2016-12-14T21:30:57.000318Z

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

gardnervickers 2016-12-14T21:32:55.000319Z

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.

gardnervickers 2016-12-14T21:33:32.000320Z

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

tony.kay 2016-12-14T21:33:33.000321Z

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

tony.kay 2016-12-14T21:33:56.000322Z

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

gardnervickers 2016-12-14T21:33:58.000323Z

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

tony.kay 2016-12-14T21:34:10.000324Z

but it also looks borked in other ways

tony.kay 2016-12-14T21:36:54.000327Z

Yeah, it must be initial app state

gardnervickers 2016-12-14T21:37:07.000328Z

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

gardnervickers 2016-12-14T21:37:16.000329Z

Or, keyed by the ident

tony.kay 2016-12-14T21:37:53.000330Z

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

gardnervickers 2016-12-14T21:37:58.000331Z

No load

tony.kay 2016-12-14T21:38:15.000332Z

then how the heck are you getting load markers 😕

tony.kay 2016-12-14T21:38:43.000334Z

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

gardnervickers 2016-12-14T21:39:46.000335Z

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

tony.kay 2016-12-14T21:40:20.000337Z

unions are my favorite feature to debug

gardnervickers 2016-12-14T21:40:47.000338Z

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

tony.kay 2016-12-14T21:41:59.000339Z

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

tony.kay 2016-12-14T21:42:02.000340Z

in the internals

tony.kay 2016-12-14T21:43:23.000342Z

go ahead and report an issue

tony.kay 2016-12-14T21:43:30.000343Z

link to that example gist

tony.kay 2016-12-14T21:43:36.000344Z

I'll see what I can find

tony.kay 2016-12-14T21:43:59.000345Z

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

gardnervickers 2016-12-14T21:45:56.000346Z

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

tony.kay 2016-12-14T21:46:09.000347Z

page switching?

tony.kay 2016-12-14T21:46:16.000348Z

you mean do we using unions?

gardnervickers 2016-12-14T21:46:16.000349Z

Tabbed navigation?

gardnervickers 2016-12-14T21:46:19.000350Z

Yea

tony.kay 2016-12-14T21:46:29.000351Z

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

tony.kay 2016-12-14T21:46:42.000352Z

it is simple enough to hook up, though

tony.kay 2016-12-14T21:46:54.000353Z

just map URL segments to ident swaps

gardnervickers 2016-12-14T21:47:01.000354Z

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

gardnervickers 2016-12-14T21:49:03.000355Z

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

tony.kay 2016-12-14T22:01:54.000356Z

not really

tony.kay 2016-12-14T22:02:08.000357Z

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

gardnervickers 2016-12-14T22:02:27.000358Z

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

gardnervickers 2016-12-14T22:12:31.000362Z

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

gardnervickers 2016-12-14T22:12:34.000363Z

😄

tony.kay 2016-12-14T22:12:55.000364Z

remove nils???

tony.kay 2016-12-14T22:13:01.000365Z

nothing you showed me had nils

gardnervickers 2016-12-14T22:13:48.000366Z

Oops I mean the load marker

tony.kay 2016-12-14T23:46:36.000367Z

@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

gardnervickers 2016-12-14T23:46:58.000369Z

Fantastic thanks for your help on this

tony.kay 2016-12-14T23:47:10.000370Z

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