These are chat archives for jdubray/sam

29th
Aug 2017
Jean-Jacques Dubray
@jdubray
Aug 29 2017 03:09
I have added a sample of for an "hash-dom" concept, a minimalist v-dom in about 20 lines of code. It'd argue this can handle 80% of apps well
Daniel Neveux
@dagatsoin
Aug 29 2017 08:50
Jumping into the conversation about mobx. The api you are looking for mutation is mobx.transaction not mobx.action. And note that sentence: https://github.com/mobxjs/mobx/issues/1139#issuecomment-323071959
Jean-Jacques Dubray
@jdubray
Aug 29 2017 09:08
:+1:
Jean-Jacques Dubray
@jdubray
Aug 29 2017 09:24
is MobX taking over React? it seems everyone is using MobX
Daniel Neveux
@dagatsoin
Aug 29 2017 09:58
Over redux you mean?
Fred Daoud
@foxdonut
Aug 29 2017 11:50
@jdubray that hash-dom concept is interesting. How would you use that to e.g. have a table of data and only update the row that has changed?
devin ivy
@devinivy
Aug 29 2017 12:16
@jdubray does it handle inputs? it typically causes issues when completely replacing input fields upon render.
Fred Daoud
@foxdonut
Aug 29 2017 12:32
There is also picodom as a minimal (1kb) vdom library.
devin ivy
@devinivy
Aug 29 2017 12:33
incremental dom's approach is like vdom, but instead it diffs against the actual dom :D
Jean-Jacques Dubray
@jdubray
Aug 29 2017 13:49
Hash-d is just a toy, sorry I should have mentioned, that's the mechanism I use in my projects though. It's good enough.
It does work at any level of the DOM so it would work with some elements of a table if the view is smart enough.
It doesn't work for inputs either.
Again is like an 80-20 approach. If you feel vdom is too much, that works well
Fred Daoud
@foxdonut
Aug 29 2017 15:25
Fair enough :thumbsup:
Jean-Jacques Dubray
@jdubray
Aug 29 2017 15:38
The only problem I ever ran into with inputs is search fields/autofocus, form fields are 100% covered with that approach because I always generate the HTML with the values I have, so I never lose any input value on re-rendering.
devin ivy
@devinivy
Aug 29 2017 15:39
specifically handling focus, is what i was thinking
when you type a character wouldn't it lose focus?
since it's a new input element
Jean-Jacques Dubray
@jdubray
Aug 29 2017 15:49
only if you trigger an action on keypressed, but it's not that hard to handle, once the view is rendered, originally I put it in nap(), but I added some lifecycle functions for complex JQuery-based widgets, that's where you would return the focus to the field.
Otherwise, the inputs works as usual, until the user submits the form, or calls any other actions.
I am not sure how sliders work with v-dom, but clearly that's not a good use case for this approach.
Jean-Jacques Dubray
@jdubray
Aug 29 2017 22:50
I don't know if it's because I am (somewhat) used to JSX, but I can't find a better syntax in vue.js options