Fork me on GitHub
#untangled
<
2017-05-16
>
cjmurphy00:05:30

The full stack untangled-ui demo uses a mock network. https://untangled-web.github.io/untangled-ui/guide.html#!/untangled.ui.Forms__10_Full_Stack_Demo But I've got it going using a real client / server setup. If I do a trick it works fine. When first up I see the list of phone numbers in the browser window, but clicking on them doesn't work. What I get is "No queries exist at the intersection of component path (app.root/Root app.ui/TopLevelRouter app.ui/TopLevelRouter-Union app.ui/PhoneList) and data path [[:screen/phone-list :tab]]" in the browser console. The trick to get everything to work is to make figwheel do some reloading of app.core by commenting out :refresh, letting figwheel hot reload, then un-commenting the :refresh.

cjmurphy00:05:11

I haven't changed any of the code, just made it full stack and obviously in different namespaces. Here's where I need to make the change https://github.com/chrismurrph/csv-to-csv/blob/master/src/client/app/core.cljs.

tony.kay22:05:49

@cjmurphy Could be something wiggy about running it in devcards

tony.kay22:05:28

sorry I’ve been gone for a while…took a trip to Alaska without my computer

cjmurphy23:05:47

Glad you're back and out from the wild! Yes I think it is something more interesting than some simple timing problem. I did try putting in an artificial delay for the client<->server round trip - simply because that's what I see as the main difference between mock and real server - but that didn't help.

tony.kay23:05:38

The hot code reload is telling.

tony.kay23:05:21

I seem to remember having a similar problem with a demo that I discovered and fixed…cannot recall the problem though

tony.kay23:05:44

so you didn’t change the UI code at all, right?

tony.kay23:05:51

The initial list of phone numbers, From server? Or are you using initial state?

cjmurphy23:05:46

I didn't change the code. Just wanted to move to client/server situation, for my own re-learning of Untangled. app.api/server-state has all the initial phone numbers, on the server. make-phone-number is now a function only available on the server.

tony.kay23:05:10

ok, so you see the items loaded from the server. interesting

tony.kay23:05:03

It’s not getting indexed right

tony.kay23:05:24

so that when transact is called, it cannot find what it wants…I’m just not sure why

cjmurphy23:05:24

Yes - I can get them to load perfectly as long as I do the comment/un-comment trick: https://github.com/chrismurrph/csv-to-csv/blob/master/src/client/app/core.cljs#L19

tony.kay23:05:37

that causes a re-render/re-index

tony.kay23:05:33

you could probably get an equivalent “fix” by adding a no-op transact to a button at the root of the UI so the thing re-renders.

tony.kay23:05:48

that’s my guess, at least

tony.kay23:05:03

OH…try adding ident functions to the components in the union

tony.kay23:05:25

and anything else missing an ident.

tony.kay23:05:50

when indexing a new component on ui refresh, I think it needs it? Not sure

cjmurphy23:05:31

Yes PhoneList and PhoneEditor don't have ident functions.

tony.kay23:05:46

they are the same as the router’s (must be, that is)

tony.kay23:05:01

I am personally a little unclear as to if/when Om needs them in both places 😕

tony.kay23:05:57

I suspect when it does a refresh render and tries to minimize refresh it needs the ident in order to properly index the (refreshed) component

tony.kay23:05:33

let me know if that fixes it

cjmurphy23:05:49

As an app programmer I always used to use idents for panels as well as entities, so would never normally have come across this issue, if indeed that is the fix.

cjmurphy23:05:19

Will do, tomorrow your time.