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
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
The card itself is here: https://github.com/awkay/table-to-tree/blob/master/src/cards/untangled_template/intro.cljs
Is the entire component’s query used as a key in app state for the data fetch indicator?
no. the data fetch indicator is placed based on the target of the result being loaded
so, for example, if using load-field the fetch indicator is placed where the field would go
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
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.
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.
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}}
I’ll try and make a devcard
I can recreate it with this https://gist.github.com/gardnervickers/687da840630c07d1e4f9721201a051c3
Here’s a screenshot of the devcard state
This shows up in the cookbook example too
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.
@gardnervickers Thanks for the effort. This used to work for you?
I don’t remember seeing it before, mostly it’s hindered our ability to easily debug app state issues.
oh, you're saying it doesn't break things, just leaves litter?
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.
I was attempting to debug those problems and found it pretty difficult with this extra query information hanging around.
That looks pretty bizzare. The entry in that map is vector-as-a-key. That doesn't make any sense
and it isn't query information. It's a load marker.
Yea, possibly a problem when constructing initial-state from the top level union?
but it also looks borked in other ways
Yeah, it must be initial app state
I would expect that if I was running a query, but at the ident right?
Or, keyed by the ident
what is your load look like, and what is the response?
No load
then how the heck are you getting load markers 😕
oh....perhaps there's a problem with merge...cause we merge the union stuff into app state
Yea I haven’t seen this happen with anything other than components that are participating in or children of a union.
unions are my favorite feature to debug
Haha, we’ve hit nothing but trouble with them.
they're the right solution to the problem. Just a little hard to write algorithms around
in the internals
go ahead and report an issue
link to that example gist
I'll see what I can find
that line in plumbing is obviously the issue, I'm just not sure why it is even involved
Out of curiosity, do you guys at Navis build page switching into your Untangled App?
page switching?
you mean do we using unions?
Tabbed navigation?
Yea
yes, but we don't do much with html5 routing around it (yet)
it is simple enough to hook up, though
just map URL segments to ident swaps
Yea we’ve been doing alright with Bidi’s router
Is it possible to work around this somehow by doing the merge ourselves?
not really
you could hand-build your app database and not use initial-state, but that sucks
Yea our app is way too big for that at this point.
Ehh postwalk to remove nils when printing works well enough I guess
😄
remove nils???
nothing you showed me had nils
Oops I mean the load marker
@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
Fantastic thanks for your help on this
could be is was written one way, something changed, and the tests were passing for bad reasons