jskelcy / life

3 stars 5 forks source link

Fix react stutter #11

Open petehunt opened 10 years ago

petehunt commented 10 years ago

add shouldComponentUpdate perf hook which fixes the bug.

damiankao commented 10 years ago

Adding this function will tell react not to update component if the props.fill didn't change? I thought react internals is supposed to figure this out?

petehunt commented 10 years ago

It will but in this case react makes the wrong perf trade off. For the common case it is faster to just render and diff the result rather than deep equal the "model" since you often render less data than what's in your model. For this case you can check the model in expensively.

So it was correct, but react just couldn't diff it fast enough to keep up because this is not the common use case.