Fork me on GitHub
#untangled
<
2016-09-22
>
grzm16:09:29

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

tony.kay16:09:55

you can force push on your branch

tony.kay16:09:58

it will auto-detect the change

grzm16:09:20

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

tony.kay16:09:33

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

grzm16:09:45

Thanks for the tip.

tony.kay17:09:32

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

grzm18:09:59

@tony.kay Thanks šŸ™‚ Hopefully your tips are a good investment and I contribute more šŸ˜‰

tony.kay18:09:36

@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.kay18:09:19

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

jasonjckn19:09:30

can I override the default error handling mechanism

jasonjckn19:09:36

like a default tx/fallback when there is none

tony.kay19:09:48

there is a global error handler you can set

jasonjckn19:09:52

nice thanks!

tony.kay19:09:50

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

tony.kay19:09:57

more like 400 error codes

tony.kay19:09:16

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

tony.kay19:09:38

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

tony.kay19:09:17

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

tony.kay19:09:37

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

ethangracer19:09:08

@tony.kay not that Iā€™m aware of

ethangracer19:09:37

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

tony.kay19:09:28

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

jasonjckn19:09:40

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

tony.kay19:09:48

other way around

tony.kay19:09:11

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

tony.kay19:09:22

and then, I think, any fallbacks

tony.kay19:09:32

@ethangracer can you short-circuit fallbacks?

tony.kay19:09:45

I'm in the code reading, so if you don't know, don't look it up šŸ™‚

ethangracer19:09:54

@tony.kay yeah Iā€™m not sure off the top of my head

ethangracer19:09:01

pretty sure that you canā€™t

ethangracer19:09:24

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

tony.kay19:09:19

@jasonjckn Confirmed. Fallbacks will always run on errors

ethangracer19:09:37

@jasonjckn the global error handler is always called, yes

tony.kay19:09:40

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

jasonjckn19:09:56

that fits my use case

tony.kay19:09:02

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

ethangracer19:09:02

@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

jasonjckn19:09:16

i have read that, i'll read it again

tony.kay19:09:18

oh right...the recipe šŸ˜‰

jasonjckn19:09:30

our whole team has read that šŸ™‚

ethangracer19:09:40

we do have some documentation šŸ˜…

tony.kay19:09:17

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

ethangracer19:09:09

@tony.kay I donā€™t fully understand what you mean by that

ethangracer19:09:20

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

ethangracer19:09:29

why would we ever need to clear the queue?

tony.kay19:09:32

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

tony.kay19:09:41

assume network is SLOOOOOW

tony.kay19:09:56

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

tony.kay19:09:04

if the first fails, then the second SURELY will

tony.kay19:09:21

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

tony.kay19:09:48

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

tony.kay19:09:12

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

tony.kay19:09:37

I should probably write down the list of "TODO" items somewhere šŸ˜‰

ethangracer19:09:44

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

tony.kay19:09:04

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

ethangracer19:09:29

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

tony.kay19:09:45

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

tony.kay19:09:15

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

tony.kay19:09:29

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

tony.kay19:09:58

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

tony.kay19:09:39

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.kay19:09:52

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

tony.kay19:09:58

see, glad we didn't write it yet....spec is evolving before our eyes šŸ™‚

tony.kay19:09:10

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.kay19:09:27

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

tony.kay19:09:51

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.kay19:09:33

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.kay19:09:23

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

ethangracer20:09:35

@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"

ethangracer20:09:56

though more fine-grained error handling is time consuming

ethangracer20:09:04

and not necessarily that much better

ethangracer20:09:50

I agree that filtering the queue is better than clearing it

tony.kay20:09:06

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

mitchelkuijpers20:09:20

@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 ^^

mitchelkuijpers20:09:37

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 šŸ˜›

mitchelkuijpers21:09:51

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.kay21:09:44

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

tony.kay21:09:25

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

mitchelkuijpers21:09:24

@tony.kay I think reset history is for @grzm šŸ˜‰

tony.kay21:09:32

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

mitchelkuijpers21:09:10

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.kay21:09:56

@mitchelkuijpers it sounds like you're about to "get it" šŸ™‚

tony.kay21:09:32

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.kay21:09:00

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

tony.kay21:09:27

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.kay21:09:39

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

mitchelkuijpers21:09:44

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

tony.kay21:09:49

There are some helper functions as well in core

mitchelkuijpers21:09:53

Aha that sound trivial.. lol

tony.kay21:09:57

let me see.....

tony.kay21:09:16

integrate-ident! is kinda handy

mitchelkuijpers21:09:18

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

tony.kay21:09:55

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

tony.kay21:09:12

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

tony.kay21:09:32

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

tony.kay21:09:20

and my experience of working with it is muuuuuch better

tony.kay21:09:55

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

tony.kay21:09:56

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

tony.kay21:09:29

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

mitchelkuijpers21:09:59

Nice that is a pretty powerful function

tony.kay21:09:14

has :prepend, :append, and :replace

tony.kay21:09:30

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

mitchelkuijpers21:09:37

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

tony.kay21:09:12

I ā¤ļø spec testing...even when we don't always do the best job of it.

mitchelkuijpers21:09:05

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.kay21:09:52

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

mitchelkuijpers21:09:08

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

mitchelkuijpers21:09:09

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ā€¦

currentoor22:09:17

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

currentoor22:09:52

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

mitchelkuijpers22:09:23

@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 šŸ™‚

currentoor22:09:34

@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