untangled

NEW CHANNEL: #fulcro
grzm 2016-09-22T16:33:29.000723Z

@tony.kay I don't know if there's a way to replace a pull request, so I just make a new one.

tony.kay 2016-09-22T16:33:55.000724Z

you can force push on your branch

tony.kay 2016-09-22T16:33:58.000725Z

it will auto-detect the change

grzm 2016-09-22T16:34:20.000726Z

Ah. It's so ingrained in me to not push a rebase.

tony.kay 2016-09-22T16:34:33.000727Z

e.g. do a git reset --soft ..., then commit the work as a single patch, then force-push

grzm 2016-09-22T16:34:45.000728Z

Thanks for the tip.

tony.kay 2016-09-22T17:04:32.000731Z

@grzm one more tip (I can take care of this one): we work against the develop branch (git flow). Master is for releases.

grzm 2016-09-22T18:12:59.000734Z

@tony.kay Thanks 🙂 Hopefully your tips are a good investment and I contribute more 😉

tony.kay 2016-09-22T18:50:36.000735Z

@mitchelkuijpers FYI, I'm continuing to work on the template (in the template workspace project I mentioned earlier). I've added full support for running all tests from the command line (cljs and clj) for CI.

tony.kay 2016-09-22T18:51:19.000736Z

I also added some example "extra routes" for REST integration with other clients, commented the sample of hooking into the Ring chain, and beefed up the README quite a bit

2016-09-22T19:05:30.000739Z

can I override the default error handling mechanism

2016-09-22T19:05:36.000740Z

like a default tx/fallback when there is none

tony.kay 2016-09-22T19:05:48.000741Z

there is a global error handler you can set

2016-09-22T19:05:52.000742Z

nice thanks!

tony.kay 2016-09-22T19:07:50.000743Z

but it is really for errors that the server "calls" errors

tony.kay 2016-09-22T19:07:57.000744Z

more like 400 error codes

tony.kay 2016-09-22T19:08:16.000745Z

there is no global idea of fallback, since the transactions are meant to be abstract mutations that need some kind of rollback

tony.kay 2016-09-22T19:08:38.000746Z

But, a helper function that always includes some specific fallback in your mutations is trivial to write

tony.kay 2016-09-22T19:09:17.000747Z

@ethangracer Did we ever get to the "clear the network queue" as a function ppl can call?

tony.kay 2016-09-22T19:09:37.000748Z

the error handling story isn't complete, and that is part of it

2016-09-22T19:10:08.000749Z

@tony.kay not that I’m aware of

2016-09-22T19:10:37.000750Z

the last modification I remember making was to add the previously received error to the lop level of the app state

tony.kay 2016-09-22T19:12:28.000751Z

I think it is time to add the support for clearing networking's throat, so to speak

2016-09-22T19:13:40.000752Z

is the global error handler still called if there's a tx/fallback?

tony.kay 2016-09-22T19:13:48.000753Z

other way around

tony.kay 2016-09-22T19:14:11.000754Z

a server response that says "bad monkey" will trigger g-e-h

tony.kay 2016-09-22T19:14:22.000755Z

and then, I think, any fallbacks

tony.kay 2016-09-22T19:14:32.000756Z

@ethangracer can you short-circuit fallbacks?

tony.kay 2016-09-22T19:14:45.000757Z

I'm in the code reading, so if you don't know, don't look it up 🙂

2016-09-22T19:15:54.000758Z

@tony.kay yeah I’m not sure off the top of my head

2016-09-22T19:16:01.000759Z

pretty sure that you can’t

2016-09-22T19:16:24.000760Z

not that there’s any harm in having it run if it isn’t implemented and just returns nil

tony.kay 2016-09-22T19:17:19.000762Z

@jasonjckn Confirmed. Fallbacks will always run on errors

2016-09-22T19:17:37.000763Z

@jasonjckn the global error handler is always called, yes

tony.kay 2016-09-22T19:17:40.000764Z

the global callback is built into the networking layer object, which (if you override) is lower level

2016-09-22T19:17:47.000765Z

Ok cool

2016-09-22T19:17:56.000766Z

that fits my use case

tony.kay 2016-09-22T19:18:02.000767Z

also, remember that overridding the network layer would lose that support

2016-09-22T19:18:02.000768Z

@jasonjckn @tony.kay see here for a higher level explanation of the error handling, if you haven’t already https://github.com/untangled-web/untangled-cookbook/tree/master/recipes/error-handling

2016-09-22T19:18:16.000770Z

i have read that, i'll read it again

tony.kay 2016-09-22T19:18:18.000771Z

oh right...the recipe 😉

2016-09-22T19:18:30.000772Z

our whole team has read that 🙂

2016-09-22T19:18:40.000773Z

we do have some documentation 😅

tony.kay 2016-09-22T19:20:17.000775Z

Yeah, we still need the ability to say "stop processing the stuff that's optimistically queued"

2016-09-22T19:23:09.000777Z

@tony.kay I don’t fully understand what you mean by that

2016-09-22T19:23:20.000778Z

I thought that everything was batched and sent at the same time, in one transaction

2016-09-22T19:23:29.000779Z

why would we ever need to clear the queue?

tony.kay 2016-09-22T19:23:32.000780Z

say you did five things in the UI, and the first transaction has gone remote, the rest are waiting

tony.kay 2016-09-22T19:23:41.000781Z

assume network is SLOOOOOW

tony.kay 2016-09-22T19:23:56.000782Z

4 are still queued. Say you said "add this new list", "add an item to that list"

tony.kay 2016-09-22T19:24:04.000783Z

if the first fails, then the second SURELY will

tony.kay 2016-09-22T19:24:21.000784Z

we rewrite tempids in the queue to deal with the fact that "add" will respond with a rewrite

tony.kay 2016-09-22T19:24:48.000785Z

but we have no way for the app to say "yeah, throw out the rest...nothing else will work"

2016-09-22T19:25:10.000786Z

gotcha

tony.kay 2016-09-22T19:25:12.000787Z

What you're missing is that these are separate UI interactions, and the net is slow...so it was multiple calls to transact!

tony.kay 2016-09-22T19:25:37.000788Z

I should probably write down the list of "TODO" items somewhere 😉

2016-09-22T19:25:44.000789Z

yeah that makes sense. no reason to trigger errors unnecessarily.

tony.kay 2016-09-22T19:26:04.000790Z

well, it might be ok to trigger them, but some ppl will want to circumvent it.

2016-09-22T19:26:29.000791Z

right, no harm in letting it happen, but no harm in circumventing either

tony.kay 2016-09-22T19:26:45.000792Z

well, we don't know. It is their data. Could be ok, could be a disaster

tony.kay 2016-09-22T19:27:15.000793Z

much more complicatd to write fallbacks that "undo" the optimistic things in a predictable manner

tony.kay 2016-09-22T19:27:29.000794Z

much easier to say "reset to the point there was no list and stop processing" (in the sample case)

tony.kay 2016-09-22T19:27:58.000796Z

but the use-cases are hard to count, so flexibility is good

tony.kay 2016-09-22T19:28:39.000797Z

but the flip side: you really do not know what is on the queue...so clearing it might leave you in an inconsistent state

tony.kay 2016-09-22T19:28:52.000798Z

Ah, which means our "clearing" support should let you filter the queue

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

see, glad we didn't write it yet....spec is evolving before our eyes 🙂

tony.kay 2016-09-22T19:31:10.000801Z

It might be that the only case you ever want to clear are those that involve tempids that were in the failed tx...perhaps we just auto-clear those?

tony.kay 2016-09-22T19:31:27.000802Z

anything that has real IDs are probably valid (if you can get them to the server)

tony.kay 2016-09-22T19:31:51.000803Z

it's really the ones that are trying to work on a thing you failed to remap that are going to be a disaster...oh, but how can we know the difference?

tony.kay 2016-09-22T19:32:33.000805Z

Yeah, unhappy path handling with optimistic updates opens a can of worms. If I had to guess: most ppl will just reset the whole app if an error occurs.

tony.kay 2016-09-22T19:33:23.000806Z

Throw something up like "There was an error. Click here to reload"

2016-09-22T20:00:35.000809Z

@tony.kay sorry got distracted by another task. that’s exactly what we’re doing in insight — click to reload for everything. works like a charm, though it’s definitely a case of “if all you have is a hammer, everything becomes a nail"

2016-09-22T20:00:56.000810Z

though more fine-grained error handling is time consuming

2016-09-22T20:01:04.000811Z

and not necessarily that much better

2016-09-22T20:01:50.000812Z

I agree that filtering the queue is better than clearing it

tony.kay 2016-09-22T20:31:06.000813Z

@mitchelkuijpers Just FYI, I renamed reset-history to reset-history!

mitchelkuijpers 2016-09-22T20:51:20.000814Z

@tony.kay thnx, I got a go from my team on moving to untangled. But you can probably expect pull request for every lein plugin for a boot counterpart, because we won’t move away from boot. I hope you don’t mind ^^

🦜 2
mitchelkuijpers 2016-09-22T20:55:37.000815Z

We are also very interested in the untangled i18n solution, we would love to remove our dictionary.clj for translations.. because it is always out of date 😛

mitchelkuijpers 2016-09-22T21:01:51.000819Z

I am just watching the "Untangled Web Framework at Portland Clojure Meetup” youtube very funny to see a part about not using query parameters for the ui… I used the beginning and after a lot of fighting we would just put them in the app state and trigger the right refreshes. Solves so much problems.

tony.kay 2016-09-22T21:09:44.000820Z

@mitchelkuijpers Love to have boot stuff as long as the boot users maintain it

tony.kay 2016-09-22T21:11:25.000821Z

I just pushed UC 0.5.6-SNAPSHOT to clojars. This adds support to the UntangledApplication interface: - Ability to clear pending network requests - Ability to reset app state to original (as if just loaded), along with trigger a possibly alternate callback - Mitchel's reset history support...oh, wait, I guess I should include that in reset app 🙂...will push again in 5 mins

mitchelkuijpers 2016-09-22T21:13:24.000822Z

@tony.kay I think reset history is for @grzm 😉

tony.kay 2016-09-22T21:14:36.000823Z

oh right

tony.kay 2016-09-22T21:15:32.000824Z

pushed...reset app should be feature complete and easy-to-use now

mitchelkuijpers 2016-09-22T21:18:10.000825Z

Btw one small question, if you load data from the server let’s say :contacts/list and I want for some reason two lists, is it possible to somehow say merge this list in :contacts/list1 and load this with different params in contacts/list2?

tony.kay 2016-09-22T21:18:56.000826Z

@mitchelkuijpers it sounds like you're about to "get it" 🙂

tony.kay 2016-09-22T21:19:32.000827Z

So, the stock Om idea is you write a parser so you can send queries to the server, have them come back as a tree, and then your parser can construct the various alternate views once that data is normalized.

tony.kay 2016-09-22T21:20:00.000829Z

As I'm sure you discovered in that model: the parser is a big maintenance point

tony.kay 2016-09-22T21:20:27.000830Z

So, in Untangled the load functions have a post-mutation parameter. The idea is that you morph the server response after it's been merged

tony.kay 2016-09-22T21:20:39.000831Z

much easier to reason about since that is a direct data transform

mitchelkuijpers 2016-09-22T21:20:44.000832Z

"the parser is a big maintenance point" that is a big YES

tony.kay 2016-09-22T21:20:49.000833Z

There are some helper functions as well in core

mitchelkuijpers 2016-09-22T21:20:53.000834Z

Aha that sound trivial.. lol

tony.kay 2016-09-22T21:20:57.000835Z

let me see.....

tony.kay 2016-09-22T21:21:16.000836Z

integrate-ident! is kinda handy

mitchelkuijpers 2016-09-22T21:21:18.000837Z

I was thinking about using post-mutations, so I was in the right direction

tony.kay 2016-09-22T21:21:55.000838Z

yeah, it just takes all that inherent complexity away...you've got to reshape stuff...why not reshape it directly?

tony.kay 2016-09-22T21:22:12.000839Z

makes the db a little larger...but really? do we care?

tony.kay 2016-09-22T21:22:32.000840Z

My vote is this is a great space vs time/complexity trade-off

tony.kay 2016-09-22T21:23:20.000841Z

and my experience of working with it is muuuuuch better

tony.kay 2016-09-22T21:23:55.000842Z

Not to insult anyone on the channel (or myself for that matter), but most engineers find direct data transforms easier than parsing logic

tony.kay 2016-09-22T21:25:56.000843Z

(integrate-ident! state [:thing 2] :append [:people/by-id 4 :things]) is an example of that helper...

tony.kay 2016-09-22T21:26:29.000844Z

does some sanity checking for you too...eliminates mutation bit-twiddling on normalized databases, since a lot of what you do is pepper idents around

mitchelkuijpers 2016-09-22T21:26:59.000845Z

Nice that is a pretty powerful function

tony.kay 2016-09-22T21:27:14.000846Z

has :prepend, :append, and :replace

tony.kay 2016-09-22T21:27:30.000847Z

and you can specify them more than once in a single call

mitchelkuijpers 2016-09-22T21:27:37.000848Z

The spec tests are helping me a lot on understanding those functions

tony.kay 2016-09-22T21:27:43.000849Z

great!

tony.kay 2016-09-22T21:28:12.000850Z

I ❤️ spec testing...even when we don't always do the best job of it.

mitchelkuijpers 2016-09-22T21:29:05.000851Z

We currently have no testing story for the ui, we do selenium testing. But we will probably start using spec for the app-state testing

tony.kay 2016-09-22T21:55:52.000852Z

Bleh selenium. Did you see @therabidbanana blog post on using devcards?

mitchelkuijpers 2016-09-22T21:57:08.000853Z

No I think I missed it, we only use selenium for our happy paths but it they are mainly so we feel confident and we are creating a JIRA Addon. So we will detect early if JIRA breaks our addon

tony.kay 2016-09-22T21:57:21.000854Z

I see

mitchelkuijpers 2016-09-22T21:58:09.000855Z

We are building on atlassian connect and the way it works you can install addons on jira cloud and we will get an Iframe in a part of the application or we will get a complete Iframe for the page. This has some pretty nasty complications as you can imagine…

tony.kay 2016-09-22T21:58:21.000858Z

https://github.com/untangled-web/untangled-client Just released 0.5.6

currentoor 2016-09-22T22:33:17.000860Z

@mitchelkuijpers, we are a boot shop happily using untangled for over 5 months now

currentoor 2016-09-22T22:33:52.000861Z

we haven't needed to write any custom untangled boot tasks, though we don't use the internationalization thingy

mitchelkuijpers 2016-09-22T22:36:23.000862Z

@currentoor Aha cool, I’ll remember that if I have any questions. I think we will look into the internationalization thingy but not in the near future, but shouldn’t be too hard to make that working 🙂

currentoor 2016-09-22T22:41:34.000863Z

@mitchelkuijpers i had the same reaction as you though, untangled seems awesome but so is boot, i only want to use it if i can make it work with boot