untangled

NEW CHANNEL: #fulcro
2016-09-26T00:20:28.001020Z

@adambros @mitchelkuijpers we haven't implemented access to Om shared because in several discussions with people on the channel we have always arrived at design alternatives that were easier to reason about

mitchelkuijpers 2016-09-26T07:25:54.001035Z

@ethangracer Yeah I also came tot that conclusion by just using a few globals and global atoms

mitchelkuijpers 2016-09-26T09:48:55.001040Z

How does the loading marker work when you load a collection? I cannot seem to get a hold of it

2016-09-26T13:02:04.001048Z

@mitchelkuijpers you can add [:ui/loading-data ‘_] to the query of any component whose query composes to root. It’s a boolean value set to true when a data fetch is in progress

mitchelkuijpers 2016-09-26T13:02:30.001050Z

Yeah, I know but I want to know if a certain query is running

2016-09-26T13:02:50.001051Z

ah, gotcha

mitchelkuijpers 2016-09-26T13:02:54.001052Z

But I noticed something strange, it won’t add the loading indicator when i add params

mitchelkuijpers 2016-09-26T13:03:01.001053Z

and it adds nil nil in the app state

2016-09-26T13:03:17.001054Z

we knew about the nil nil, not sure we caught the loading indicator too

mitchelkuijpers 2016-09-26T13:03:41.001056Z

Yeah I saw the nil nil in the issues

2016-09-26T13:04:05.001058Z

the loading indicator should show up in the location in app-state where the data will be placed

2016-09-26T13:04:14.001059Z

if it isn’t, then you should file a bug

mitchelkuijpers 2016-09-26T13:04:20.001060Z

Yeah, it only does when I remove the params

2016-09-26T13:04:23.001061Z

weird

mitchelkuijpers 2016-09-26T13:04:33.001062Z

The two are probably related

2016-09-26T13:04:39.001063Z

yeah definitely throw a minimal repro up as a github issue and I’ll take a look

mitchelkuijpers 2016-09-26T13:04:48.001064Z

Sure

mitchelkuijpers 2016-09-26T13:04:52.001066Z

Thnx

2016-09-26T13:04:56.001067Z

yeah, thank you

mitchelkuijpers 2016-09-26T13:20:11.001070Z

@ethangracer https://github.com/untangled-web/untangled-client/issues/32 Very easy to reproduce ^^

2016-09-26T13:21:09.001072Z

@mitchelkuijpers interesting, even when :marker is set to false?

2016-09-26T13:21:18.001073Z

if :marker is false there should never be a ui fetch state

2016-09-26T13:21:26.001074Z

right?

2016-09-26T13:22:44.001075Z

yeah, if :marker is not specified, it defaults to true

2016-09-26T13:23:00.001076Z

cool, I’ll play around. thanks

mitchelkuijpers 2016-09-26T13:23:51.001077Z

Thnx man

2016-09-26T13:36:55.001078Z

@mitchelkuijpers I pulled down your repo and am trying to run it, but there don’t appear to be any html files in the resources folder… ?

mitchelkuijpers 2016-09-26T13:37:05.001079Z

Ow lol

mitchelkuijpers 2016-09-26T13:37:15.001080Z

Hold on

2016-09-26T13:37:30.001081Z

k

mitchelkuijpers 2016-09-26T13:38:08.001082Z

Pushed

2016-09-26T13:38:13.001083Z

thanks

2016-09-26T15:15:03.001086Z

@mitchelkuijpers you’re right, they are related

2016-09-26T15:16:09.001089Z

There’s a bug in untangled.client.impl.data-fetch/data-query-key where it returns nil on a parameterized query. So a load marker is put under key nil and cleared out once the load is completed.

mitchelkuijpers 2016-09-26T15:16:49.001090Z

Aha that explains the nil key

2016-09-26T15:16:55.001091Z

which is also why the load marker isn’t in the right place

2016-09-26T15:16:56.001092Z

yup

2016-09-26T15:17:01.001093Z

two birds one stone 🙂

mitchelkuijpers 2016-09-26T15:17:04.001094Z

Nice

mitchelkuijpers 2016-09-26T15:18:30.001095Z

Would you like me to submit a pull request?

mitchelkuijpers 2016-09-26T15:18:37.001096Z

I would be happy to fix it

2016-09-26T15:20:45.001097Z

Thanks for offering, should be pretty quick I have this one

mitchelkuijpers 2016-09-26T15:21:02.001098Z

Cool

mitchelkuijpers 2016-09-26T15:21:08.001099Z

I think you might be fixing 3 issues

mitchelkuijpers 2016-09-26T15:21:18.001100Z

https://github.com/untangled-web/untangled-client/issues/24

mitchelkuijpers 2016-09-26T15:21:22.001102Z

this one is also related?

2016-09-26T15:25:30.001103Z

haha yup

2016-09-26T15:25:34.001104Z

I think I got that one

mitchelkuijpers 2016-09-26T15:25:58.001105Z

We’ll this will be a good fix then, i liked them to the issue for you

2016-09-26T15:26:17.001106Z

the logic in those files could use some serious code tuning

2016-09-26T15:26:35.001107Z

@tony.kay another project during documentation week, perhaps, would be to explore simplification of the data fetch logic

2016-09-26T15:27:00.001108Z

@mitchelkuijpers thanks for linking

mitchelkuijpers 2016-09-26T15:27:49.001109Z

No problemo, happy to help. If you guys ever have some small things that needs fixing but no time be sure to give me a heads up. Would love to contribute some work back

2016-09-26T15:40:58.001110Z

awesome! that’s much appreciated

2016-09-26T15:41:45.001111Z

just writing some tests and I’ll send it up to github. we’ll have to wait for tony for a snapshot update

mitchelkuijpers 2016-09-26T15:47:33.001112Z

Cool thnx

tony.kay 2016-09-26T15:59:45.001113Z

@ethangracer hit me with a PR on that pls

2016-09-26T15:59:55.001114Z

will do

2016-09-26T16:02:19.001115Z

untangled spec is giving me a hard time for some reason

tony.kay 2016-09-26T16:02:40.001116Z

😕

2016-09-26T16:05:11.001117Z

I can’t get the tests to run so I’m going to submit the patch as a PR

2016-09-26T16:05:20.001118Z

I’ll fix the testing when I refactor

tony.kay 2016-09-26T16:05:36.001119Z

commented out at the moment and manually tested?

mitchelkuijpers 2016-09-26T16:06:45.001120Z

Is there a way to just unmount an untangled app and mount it again? Our om.next solution was add-root! and remove-root! I am integrating with a bigger application and I am having a hard time changing the root dom-node

tony.kay 2016-09-26T16:07:55.001121Z

you can use Om's remove-root!...it is an Om app

tony.kay 2016-09-26T16:08:17.001122Z

the new reset stuff might be needed for remounting...have not tried it

2016-09-26T16:10:19.001125Z

Something appears to be broken with our Travis CI build

2016-09-26T16:10:26.001126Z

not running the tests

tony.kay 2016-09-26T16:10:39.001127Z

travis Firefox is kinda flaky...sometimes fails for bad reasons like timeouts

tony.kay 2016-09-26T17:59:09.001134Z

0.5.7-SNAPSHOT is on clojars of client. Should fix a number of load marker bugs

tony.kay 2016-09-26T17:59:46.001135Z

@mitchelkuijpers I would recommend that you avoid loads triggered from component mount, since React can do mount/unmount at unexpected times

tony.kay 2016-09-26T18:00:12.001136Z

You're better off doing the loads from the operation that led to your UI change that leads to the mount of that component

tony.kay 2016-09-26T18:01:14.001137Z

that way arbitrary UI changes that lead React to think one thing is going away and another is coming in (where in fact they are the same thing) won't cause subtle bugs

tony.kay 2016-09-26T18:02:30.001138Z

If anyone knows how to get Travis CI to do a better job of running tests through Firefox, let me know. Our tests pass, but when Travis runs Firefox it often times out and counts all tests as failing

mitchelkuijpers 2016-09-26T18:15:27.001140Z

Yeah I don't do that. This was only a small playground

mitchelkuijpers 2016-09-26T18:16:02.001143Z

Thanks for the snapshot!

2016-09-26T18:22:34.001144Z

let's say in the UI the user can 'update the status of object ID <id> to <NEW_STATUS>' in the backend this is idempotent, it tries to succeed regardless in a number of scenarios e.g. (1) status is updated (2) status was already set to new status (3) it did some workaround in an error case, and I want feedback into the UI about which path it took to succeed

2016-09-26T18:22:41.001145Z

is this a load field action + api-read ?

2016-09-26T18:22:47.001146Z

since there's data flowing from server to client

2016-09-26T18:22:53.001147Z

(the feedback)

mitchelkuijpers 2016-09-26T18:42:49.001148Z

Btw is it possible to get the result of a remote mutation (the response?)

mitchelkuijpers 2016-09-26T19:14:22.001149Z

@ethangracer I can confirm that the fix works 🙂 thank you so much

2016-09-26T19:14:34.001150Z

woohoo!

2016-09-26T19:14:50.001151Z

your welcome. glad you’re enjoying untangled so far

mitchelkuijpers 2016-09-26T19:15:05.001152Z

Yeah I am currently deleting all of my om.next reads

mitchelkuijpers 2016-09-26T19:15:08.001153Z

loads of fun

👌 2
🙏 1
adambros 2016-09-26T20:36:49.001158Z

@mitchelkuijpers i dont think we let you access the response of a mutation, but there is technically a untangled.client.mutations/post-mutate that gets called after a mutation’s :action https://github.com/untangled-web/untangled-client/blob/b5b1106ae89470651c040af3469652f6033f1b8c/src/untangled/client/impl/om_plumbing.cljs#L38

adambros 2016-09-26T20:38:24.001163Z

what are you wanting the result of a mutation for?

mitchelkuijpers 2016-09-26T20:44:59.001164Z

I am porting some code where we add something to a list and then clientside we have to call a method to update a counter, so that mutation returns the data we need to calculate that counter (we need to do this client-side, because of reason with atlassian-connect integration)

mitchelkuijpers 2016-09-26T20:45:40.001165Z

But maybe we should just add a new read to get that information

adambros 2016-09-26T20:46:14.001166Z

yeah you could either figure out how to make the response available, or you just need to add a level of indirection and have a server side counter

adambros 2016-09-26T20:46:29.001167Z

then you could just [(inc-counter) :counter]

mitchelkuijpers 2016-09-26T20:46:54.001171Z

Haha i know the escaping of mutations 😉

adambros 2016-09-26T20:47:03.001172Z

are you talking directly to atlassian? haha yeah i couldnt figure it out

mitchelkuijpers 2016-09-26T20:47:09.001173Z

Yes

adambros 2016-09-26T20:48:01.001174Z

hmm well then im not sure what your best option is, but i can tell you that you’d be poking around here: https://github.com/untangled-web/untangled-client/blob/26c1844958433dbcee0838a5521fb1885b485a3e/src/untangled/client/core.cljs#L104 and making the :response-channel optionally pluggable

adambros 2016-09-26T20:48:37.001176Z

either cb, a multimethod or something

mitchelkuijpers 2016-09-26T20:49:09.001178Z

I could fix this with a read so I might try that

adambros 2016-09-26T20:49:43.001179Z

try that, but it could be useful to have a story for mutating non untangled-server api’s and wanting the response

mitchelkuijpers 2016-09-26T20:49:45.001180Z

I think ill just do an optimistic update 🙂

adambros 2016-09-26T20:49:51.001181Z

hehe yeah that too

mitchelkuijpers 2016-09-26T20:50:03.001182Z

then I can just revert when necessary

mitchelkuijpers 2016-09-26T20:51:01.001183Z

But still it might be usefull indeed

mitchelkuijpers 2016-09-26T20:51:33.001184Z

I expected that the post-mutation would have it

adambros 2016-09-26T20:51:35.001185Z

we’ll be having a documentation/refactoring iteration in a week or two, so i could take care of that easily/quickly if you need it

adambros 2016-09-26T20:51:52.001186Z

hell i could do it now if you really need it

mitchelkuijpers 2016-09-26T20:53:14.001187Z

I can wait I’ll change it to an optimistic update (I find that a nice solution)

mitchelkuijpers 2016-09-26T20:53:24.001188Z

But it would be a nice improvement

mitchelkuijpers 2016-09-26T20:53:32.001189Z

Do you want me to create an issue?

adambros 2016-09-26T20:53:50.001190Z

i think tony may be of the opinion you should normally be doing an optimistic update followed by reads

adambros 2016-09-26T20:53:57.001191Z

but feel free to make one and we can discuss this there

mitchelkuijpers 2016-09-26T20:54:05.001192Z

Sure thnx

2016-09-26T21:14:50.001193Z

@adambros @mitchelkuijpers the intended design pattern is to do the remote mutation followed immediately by a remote fetch

2016-09-26T21:15:16.001194Z

e.g [(remote/mutation) (untangled/load-data query)]

2016-09-26T21:15:34.001196Z

mutations only return tempids

adambros 2016-09-26T21:16:16.001199Z

right, but how does it work if you talk directly to a non-untangled server?

adambros 2016-09-26T21:16:26.001200Z

esp one that you dont control

2016-09-26T21:16:49.001201Z

wouldn’t that just be a standard http post?

2016-09-26T21:17:01.001202Z

I suppose you could build a custom untangled networking object

adambros 2016-09-26T21:17:02.001203Z

if i think about it @mitchelkuijpers must have an untangled-server, so i dont know what he meant by he talks directly to atlassian

adambros 2016-09-26T21:17:44.001205Z

i suppose, but what if you also have an untangled server?

2016-09-26T21:18:25.001206Z

yeah you’d have to have something like multiple om remotes

adambros 2016-09-26T21:18:42.001207Z

yeah, which we dont support yet

adambros 2016-09-26T21:19:02.001208Z

anyway i think the recommended route is to have an untangled server communicate with these other services

grzm 2016-09-26T21:36:09.001209Z

For another data-point, I'm using untangled-client with my own (pedestal-based) server. It's working fine. I just make sure I return the tempid mapping.

tony.kay 2016-09-26T21:51:24.001211Z

@adambros @mitchelkuijpers @ethangracer Ethan is correct here. The Om model is that mutations can remap tempids. There is no return value. The reason for this is that there is no query, so there is no way to merge that result into your database. Thus, the follow-on remote read

tony.kay 2016-09-26T21:52:41.001212Z

This is a common misconception about the overall model

tony.kay 2016-09-26T21:53:41.001213Z

The model is that the mutation is abstract. The UI and Server have no coupling. The server has no idea what you're showing, and the client has little idea (other than advertised keywords on the mutation...which isn't documented well, but is part of Om) what the server is really doing.

tony.kay 2016-09-26T21:54:04.001214Z

So, in order to fix this gap, the client specifically asks for reads on the data that it knows it is displaying that could have changed on the server

tony.kay 2016-09-26T21:54:19.001215Z

The mutation would have to "cover the bases" to ahve a return value (and it would have to have a normalization query)

tony.kay 2016-09-26T21:54:23.001216Z

E.g.

tony.kay 2016-09-26T21:54:51.001218Z

Say you have a mutation add-friend. The server could return all manner of information: the new friend count, a success code, the list of current friends

tony.kay 2016-09-26T21:55:09.001219Z

Now you're tempted to make a mutaiton for every possible return value? Or just send it all back?

tony.kay 2016-09-26T21:55:27.001220Z

None of that is nearly as simple as the UI directly saying: do this, and then I need to know this other thing

tony.kay 2016-09-26T21:56:26.001221Z

If you read the Om docs David mentions listing keys on a mutation. These are where you put advisory documentation on your mutation as to what data items the mutation affects, so that a UI programmer can read that (as documentation) and decide what to explicitly query

tony.kay 2016-09-26T21:57:27.001222Z

I'd recommend documenting the affected keys in whatever way makes sense for your developers, because this is a point of difficulty (and maintenance), though in practical systems it is pretty obvious what things you might want to read because the mutation is an abstraction with general meaning.

tony.kay 2016-09-26T21:57:45.001223Z

E.g. in the add-friend case I can guess that my friend count just changed.

tony.kay 2016-09-26T21:58:17.001224Z

It is a subtle shift, and I understand the desire to want a "return value"...but they just don't make sense in the overall model

tony.kay 2016-09-26T21:59:00.001225Z

(and I'd argue that David is right here...this is a simpler/better approach to the problem of UI composition)

tony.kay 2016-09-26T21:59:36.001227Z

I really need to write this all down in a Blog entry or something 😄

2016-09-26T22:58:42.001230Z

I think that explanation helped me a lot - a blog post about the model would be great. 🙂

tony.kay 2016-09-26T22:59:44.001231Z

oh boy...yeah, sounds like I really need to do it if you've written a complete commercial app and you're just getting it 😜

2016-09-26T23:14:50.001232Z

Heh, yeah - I generally understand that mutations don't return anything, but I've never really tied together the reasoning behind it is specifically "you don't know what to return because that's what reads are for"