Fork me on GitHub
#untangled
<
2016-04-01
>
currentoor00:04:52

@tony.kay: Thanks for the info. This all makes sense. I'll tinker with the file watching this weekend.

currentoor00:04:49

Also, @tony.kay is API meant to be stable now or too early to say? Is backwards compatibility going to be important?

tony.kay02:04:01

@currentoor: The API is pretty stable. We have renamed a thing or two recently, but nothing major. I do expect there to be more extension points. The i18n lein plugin needs work, the support viewer is very alpha, but the core application framework should be pretty stable.

cjmurphy03:04:49

@ethangracer, @mahinshaw: Here is a minimal app where a follow-on mutate keyword actually works - in that only the item you have changed gets re-rendered: https://github.com/chrismurrph/om-alarming/blob/master/test/misc/checkboxes.cljs - you are given gases and the ones selected are a subset - the lines you want to graph. As you select or unselect it will show you in the dev console which item/s being re-rendered. Trouble is I have found it hard to form any kind of theory as to why it is working, let alone apply some theory to a larger application. In my big application I'm now going to be doing all mutates from the Root component, just like Kanban does it. I suspect that you with the ToDoMVC app, me and the Kanban author have all had the same problem. Would be really good for someone to try to fix the ToDoMVC app. If it can't be fixed then good because we have a small example of the problem.

tomjack04:04:48

why are you rereading :app/customers?

cjmurphy05:04:29

Oh yeah - that was just to show that it doesn't matter what keyword you put in it has the same effect. Part of experimenting. I put customers in there as something completely unrelated.

cjmurphy05:04:52

Didn't realize it was re-reading that keyword but good that it is. Shows that even when you get re-rendering only one of the items working - shows there's no sensible theory to explain why it is working.

cjmurphy05:04:27

Well the theory is (I really have no idea what I'm talking about) I think that some diff-ing is going on - but hard to know how to make it work and not really a part of Om Next - which just always re-renders everything from the top. The only time people experience not rendering is when there are problems with normalization. (These are my working assumptions, I'm almost 100% sure these are not correct statements).

tomjack05:04:34

wow, I just learned from your example that you can pass collections as dom/* children. thanks simple_smile

cjmurphy05:04:13

Okay great, not exactly sure what you mean thou 😛 One thing is I'm getting rid of for now and replacing them with map. I learnt from a chat recently on Reagent channel that for and into don't play that well with React. And all the other examples use map so best to follow suit...

tomjack05:04:44

I think that chat fell off the logs 😞

cjmurphy05:04:49

Do you use for?

cjmurphy05:04:51

for sequence comprehensions to be quite correct!

cjmurphy05:04:26

It was by someone who used to be in the om channel making the point that using into or for stop the react id problems. And then Gadfly explained not too efficient/correct use of React. But that might be particular to Reagent. But then all the examples we are shown (iirc) use map. Hence I'm making the switch, but missed one in that code.

cjmurphy05:04:49

Hmm - just thinking about it we can probably do what we like in render methods - we are more protected than Reagent users. Reagent is actually reading the code whereas Om Next just calls the render method, that ought to be side-effect free (although print statements still work fine, unlike with mutations).

ethangracer15:04:53

@cjmurphy: I believe what is happening there is that React is DOM diffing all of the checkboxes and is only re-rendering the one that changed. Adding :app/customers triggers React to DOM diff because it is queried for by the root component, so the entire UI tree is diffed by React for re-rendering. Not sure why that’s different, if it is, for todomvc

cjmurphy15:04:30

If you can rely on println messages from render then it is different with the todomvc. I put some in and every item was rendered per change of one. To make them the same the call to transact! would come down to the child.

cjmurphy15:04:57

.. as I'm sure you know already.

ethangracer15:04:33

yeah not sure why that is, i’ll look into it. as for your test file, I don’t have the time to confirm it, but you could override all of your components’ shouldComponentUpdate functions to return true. Then you might see everything re-render since the re-render call is coming from root

cjmurphy15:04:16

Okay will do.

cjmurphy15:04:36

Yes you are correct. All items re-render when shouldComponentUpdate is returning true from the 'item': GraphLineSelectionCheckbox.

ethangracer16:04:03

makes sense, so the way that om overrides shouldComponentUpdate correctly returns true only for the component instances with changed props or component local state

cjmurphy17:04:26

It would be so nice if there was a possibility to easily log that behaviour, to answer the question 'why are so many component instances being re-rendered after such and such a mutation?' I guess it doesn't matter too much that you can use any follow on key you like, as long as Om gets the specificity right the way you say (changed props or component local state). I still don't yet trust that Om does get it right. This little demo was supposed to be the minimal example showing that it doesn't 😬

currentoor17:04:40

So Om has a pretty cool caching story where you can have multiple remotes and use http caching based on remote type and a hash of the query. Since untangled does network plumbing for us, is there still a way to take advantage of om's caching philosophy?

currentoor18:04:14

This caching stuff is not something I have to have right away but it would be nice to know we can use it after we launch and want to do performance tweaks.

currentoor18:04:28

Which would be months from now.

ethangracer20:04:24

@currentoor: we’re completely circumnavigating the read-remote functionality of om and (to my knowledge) everything associated with it. You can define a custom networking object though, core/new-untangled-client takes a networking object and impl.network has the UntangledNetwork protocol that we expect a custom network to implement

currentoor20:04:51

Ah I see, that makes sense. Thanks!

ethangracer21:04:04

Yup! The customization piece of networking is definitely in its infancy, we built it basically to give the user the option to use something other than XhrIo, but it could be extended in other ways I’m sure

currentoor22:04:59

Yeah, we'll probably need a push notification system at some point.

currentoor22:04:34

Props to whoever wrote the datomic migration dsl. Very convenient.