From 6c061a3170005598b64168273410322b4f7807e5 Mon Sep 17 00:00:00 2001 From: Barney Carroll Date: Fri, 29 Jul 2016 10:55:37 +0100 Subject: [PATCH] Gotchas imply onbeforeupdate is inherently evil The premature optimisation warning talks about `onbeforeupdate` as though returning false were its only purpose. In fact it's also useful for transforming simple input into a detailed model for the view, input-state comparisons for change highlighting, etc. --- docs/lifecycle-methods.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/lifecycle-methods.md b/docs/lifecycle-methods.md index 1ed2f9567..74a839d8a 100644 --- a/docs/lifecycle-methods.md +++ b/docs/lifecycle-methods.md @@ -252,7 +252,7 @@ var WorkingComponent = { #### Avoid premature optimizations -The `onbeforeupdate` hook should only be used as a last resort. Avoid using it unless you have a noticeable performance issue. +You should only use `onbeforeupdate` to skip diffing as a last resort. Avoid using it unless you have a noticeable performance issue. Typically performance problems that can be fixed via `onbeforeupdate` boil down to one large array of items. In this context, typically "large" means any array that contains a large number of nodes, be it in a wide spread (the infamous 5000 row table), or in a deep, dense tree.