intercellular / cell

A self-driving web app framework
https://www.celljs.org
MIT License
1.51k stars 94 forks source link

Updating cells #152

Closed mrjjwright closed 7 years ago

mrjjwright commented 7 years ago

I am working on a Mobx integration. I don't use local state on components, but Mobx, because Mobx is a comprehensive solution for minimal state. I am still working out how to best integrate Mobx and cell.js. I assume I should call $update on the cell I want to update explicitly. What is the official way to force an update or render of a cell or component (cell subtree)? In React it's called forceUpdate (that is what mobx-react uses).

Thanks for this awesome library!

gliechtenstein commented 7 years ago

The "official" way to updating cell nodes is to

  1. attach some _variables that represent the node (and will translate into the view).
  2. update the _variables
  3. and let that auto-trigger the $update() function on the same node, from which you can modify the node's view.

But manually triggering $update() is valid too, and I can imagine in some cases that's necessary. Keep us posted how that goes!

mrjjwright commented 7 years ago

Thanks!