untangled

NEW CHANNEL: #fulcro
tony.kay 2016-09-29T00:08:44.001459Z

"a page that does a load-field" worries me

tony.kay 2016-09-29T00:09:49.001460Z

the only statement that is reasonably value around load* is "such and such mutation triggers a load", "startup callback triggers a load", or "such and such user event on the UI triggers a load"

2016-09-29T13:01:48.001468Z

@tony.kay fyi turns out that bug I saw yesterday wasn’t an untangled bug. om/db->tree was confused by a weird ident, like you initially suspected

2016-09-29T13:15:39.001469Z

the data wasn’t being wiped from the app-state, but when I looked up the location at one ident the data was gone because it had been placed at another ident

2016-09-29T13:15:54.001470Z

confusing but it was just a component design issue

tony.kay 2016-09-29T15:47:19.001471Z

cool. I figured. We'd have a lot more bug reports if you'd found a bug on that 🙂

gardnervickers 2016-09-29T16:31:38.001475Z

Hey all! I think I found a bug with follow-on-reads from within a union query, but I was hoping to double-check that I’m doing things right before opening an issue. Here’s a devcard reproduction of the problem I’m seeing. https://gist.github.com/gardnervickers/a1fcbd04132271f9f18e9e6fecb15822 Essentially there’s two unions here, the first one has the Main and Settings tab. Inside the “Settings` tab are two child components, one is a union with two elements, ActiveUsersTab and HighScoreTab, the other child of Settings has two buttons that increment ActiveUsersTab and HighScoreTab. This all works as expected until you add follow-on-reads to the button mutations. It doesn't actually matter if the follow-on-reads even point to anything legitimate, or if the mutation actually mutates anything. If you switch the currently viewed inner union component via “show high score” or “show active users”, and then run any mutation that has a follow-on-read, you end up with #error {:message "No queries exist for component path (cards.union-follow-on-reads/Root cards.union-follow-on-reads/TabUnion cards.union-follow-on-reads/SettingsTab cards.union-follow-on-reads/SettingsChooser) or data path [[:settings :tab] :settings-chooser]", :data {:type :om.next/no-queries}}

tony.kay 2016-09-29T16:36:27.001476Z

@gardnervickers So, if this is a bug, it is a bug in your code or Om, not Untangled.

tony.kay 2016-09-29T16:36:53.001477Z

Make sure you're using the latest Om. The kind of error you're seeing is something that has reared up a few times

gardnervickers 2016-09-29T16:37:11.001478Z

Ok gotcha, thanks.

tony.kay 2016-09-29T16:38:08.001479Z

So just for your own info:

tony.kay 2016-09-29T16:38:32.001480Z

follow on reads hit the Om indexer to find things. This is why you can use single keywords instead of queries/component paths

tony.kay 2016-09-29T16:38:44.001481Z

The indexer tries to return all of the components that use that keyword

tony.kay 2016-09-29T16:39:25.001482Z

those get thrown into a re-render list, and at the next render Om tries to optimize the re-renders by running component-local queries (based on the ident of the component) to refresh the state of the UI of those components

gardnervickers 2016-09-29T16:40:13.001483Z

Hmm ok thats helpful

gardnervickers 2016-09-29T16:45:53.001484Z

I noticed that components that are part of a union don’t have an ident, but one would think that they’d take the ident that their parent calculated for them. Is it alright to give them idents?

2016-09-29T17:37:32.001485Z

We discovered a problem in IE 11(Edge engine) or Edge browser with input fields when using Om/Next. The onChange event is not always firing on the input field when we specify a :value for the input field. Om/Next utilizes the requestAnimationFrame feature (or setTimeout) and that appears to be whats causing the issue with Edge. To work around this issue i switched to using the onInput event instead which is always fired. I have reported the problem to Microsoft under https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9125100/

gardnervickers 2016-09-29T18:17:30.001486Z

Switching out the Untangled client for vanilla om.next fixes my problem with the nested union follow-on-reads. I’m even using Untangled’s parser read function. I’ll keep looking, maybe it’s an issue with my code but it seems that the Untangled client is doing something I’m not aware of. https://gist.github.com/gardnervickers/a1fcbd04132271f9f18e9e6fecb15822/revisions

tony.kay 2016-09-29T19:12:59.001487Z

Hm. Not sure how you'd do that "switch out" without writing a parser. In that case, there could possibly be a bug in our implementation of read for that particular circumstance.

tony.kay 2016-09-29T19:15:15.001489Z

@gardnervickers I guess that can't be it, though, since you used our read

tony.kay 2016-09-29T19:16:00.001490Z

did you do lein deps :tree to see what your om next version was when using Untangled? Is it specified in your project?

gardnervickers 2016-09-29T19:17:36.001491Z

Yea we excluded it from untangled and manually brought in the newest version.

tony.kay 2016-09-29T19:18:38.001492Z

I'm not sure what logic you've "excluded" by removing untangled (since you used Untangled's read code)

tony.kay 2016-09-29T19:19:07.001493Z

Well, you also removed the initialization of unions

tony.kay 2016-09-29T19:19:24.001494Z

since Untangled does that...so your InitialAppState isn't going to work right

gardnervickers 2016-09-29T19:19:33.001495Z

Yea, I’m supplying a normalized DB

tony.kay 2016-09-29T19:19:42.001496Z

yeah, I see that now

tony.kay 2016-09-29T19:20:06.001497Z

so, that is a difference. It could be that our union initialization code is failing to make sure the right metadata is on the initialized data in app state...I'm not aware of anything that is needed there, though

tony.kay 2016-09-29T19:22:33.001499Z

when you dump the app state from the Untangled version is it different (when constructed from InitialAppState)?

gardnervickers 2016-09-29T19:22:59.001501Z

Thats actually how I am generating the pre-normalized db

gardnervickers 2016-09-29T19:23:14.001502Z

I just printed that and used it

tony.kay 2016-09-29T19:25:05.001503Z

weird

tony.kay 2016-09-29T19:25:43.001504Z

I'm concerned that maybe you needed to clean/rebuild, and you were possibly seeing a problem from the build system failing to update code properly.

tony.kay 2016-09-29T19:25:55.001505Z

It could be your "fix" was just that it recompiled properly?

gardnervickers 2016-09-29T19:26:24.001506Z

If I wanted to disable getting initial-state from the components, is it sufficient to just not compose it back up to the root and supply my own normalized db atom for :initial-state?

tony.kay 2016-09-29T19:26:30.001507Z

yep

tony.kay 2016-09-29T19:26:53.001508Z

just don't implement the interface

tony.kay 2016-09-29T19:26:56.001509Z

on the root

gardnervickers 2016-09-29T19:27:45.001510Z

If Root does not implement InitialAppState, sub component’s that do implement InitialAppState should not have their initial-state incorporated into the app state, correct?

tony.kay 2016-09-29T19:27:53.001511Z

correct

gardnervickers 2016-09-29T19:27:58.001512Z

Ahh that might be it

tony.kay 2016-09-29T19:27:59.001513Z

the logic just tries to detect it on root

gardnervickers 2016-09-29T19:28:28.001514Z

I’m seeing initial-state on one of my unions called even though Root does not implement InitialAppState

tony.kay 2016-09-29T19:28:37.001515Z

Although now that you say THAT, I wonder if our logic short-circuits the union inits properly in that mixed case...it wasn't one I would ever expect

gardnervickers 2016-09-29T19:28:45.001516Z

and it’s value is being pulled into app state

tony.kay 2016-09-29T19:29:12.001518Z

yeah...that mixed case isn't supported

tony.kay 2016-09-29T19:29:33.001519Z

but that is a minor bug...we shouldn't try to do union integration if there is no root InitialAppState

grzm 2016-09-29T19:35:43.001520Z

@tony.kay You use git flow, right? Do you use the git flow scripts or just the pattern?

gardnervickers 2016-09-29T19:36:29.001521Z

Disabling initial-state on all my components still results in that error. If it’s not the reads or the normalization process there’s gotta be something going on with the mutations. I’ll look there

tony.kay 2016-09-29T21:14:51.001525Z

@grzm we use the home brew git-flow-avh package (which installs the scripts)

tony.kay 2016-09-29T21:15:23.001526Z

@gardnervickers Thanks for tearing into that. No time on my end, but very willing to merge a PR if it is an Untangled problem