Yomguithereal / react-blessed

A react renderer for blessed.
MIT License
4.45k stars 177 forks source link

Render diffs #53

Open mattstyles opened 8 years ago

mattstyles commented 8 years ago

Howdy,

At the moment the react-blessed renderer is recreating the tree with each render call, this differs from react-dom which attempts reconciliation with the dom rather than stamping over it (too much). This means that you can't use top-down data-flow with react-blessed as each render call effectively recreates the entire tree, and, actually, I've noticed a hefty slow down after repeatedly calling render, is there also a clear-up issue?

Am I right with this thinking? And is there a quick-win using one of the component update lifecycles to stop react-blessed from recreating everything each render?

I've stuck a side-by-side with react-dom in this repo, the blessed and browser files are near identical and they just render a list of items, the react-blessed one remounts (which I'm assuming means its recreating) the list each render whereas react-dom reconciles and should just be performing 2 dom ops (unhighlight old selected node, highlight selected node). I think.

Are there any plans to support working out the minimum amount of mutations required for blessed? I had a quick look and I'm guessing it is not an easy task as the blessed components have a richer public api than the dom generally does. Any ideas how to get unidirectional data shizzle working without having to totally recreate the diff-application algorithm?

revolunet commented 7 years ago

can we prevent renders with componentShouldUpdate with react-blessed ?

Yomguithereal commented 7 years ago

I guess so. Never tried it though. @revolunet maybe your issue with the list comes from this. @mattstyles there is probably a bug somewhere in my code that implies remounts (or maybe I was lazy and did not properly diffed somethings).

philraj commented 5 years ago

any news on this? i'm getting a ton of complete redraws with distracting blanking when a list of items is being updated

Yomguithereal commented 5 years ago

Hum... I don’t remember the specifics of the problem very clearly right now. As I recall the upgrade to latest reconciler logic did something bad but I cant be sure. Unfortunately I don’t have much time right now to investigate. Will definitely review any related PR though. Else you can try to ping me in two weeks when I can find more time.