From f53b4e4d20209b79e749fa7a72887c2dacc404fc Mon Sep 17 00:00:00 2001 From: Dan Holmsand Date: Mon, 14 Dec 2015 15:41:46 +0100 Subject: [PATCH] Add news about next-tick and after-update --- CHANGELOG.md | 4 ++++ demo/reagentdemo/news/news060.cljs | 26 +++++++++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25be765..732daa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,10 @@ - `cursor` now shares state between all instances corresponding to a given set of parameters. +- `next-tick` now evokes its argument function at a clearly defined time (immediately before rendering, which is in turn triggered using requestAnimationFrame). + +- `after-update` is a new function, similar to `next-tick`, except that the function is evoked immediately after rendering. + - Support `[:> nativeComp {:foo "bar"}]` - Reagent now falls back to using `require` if global `React` is undefined, to simplify use with e.g webpack and node.js. diff --git a/demo/reagentdemo/news/news060.cljs b/demo/reagentdemo/news/news060.cljs index 5b2f057..71ce6f0 100644 --- a/demo/reagentdemo/news/news060.cljs +++ b/demo/reagentdemo/news/news060.cljs @@ -321,6 +321,18 @@ that unnecessary re-renderings were avoided) when passed as arguments to child components."]] + [:section.demo-text + [:h2 "Tapping into the rendering loop"] + + [:p [:code "next-tick"]" is an existing function, that now has + a more predictable timing. It takes a function that is invoked + immediately before the next rendering (which is in turn + triggered using "[:code "requestAnimationFrame"]")."] + + [:p [:code "after-update"]" works just + like "[:code "next-tick"]", except that the function given is + invoked immediately "[:b "after"]" the next rendering."]] + [:section.demo-text [:h2 "Breaking changes"] @@ -338,13 +350,13 @@ function, "[:code "reagent.ratom/reaction"]", "[:code "reagent.ratom/run!"]" and "[:code "reagent.ratom/make-reaction"]" are now lazy and executed asynchronously. Previously, reactions used to - execute directly whenever the atoms they depended on changed. - This could cause performance issues in code with expensive - reactions and frequent updates to state. However, this change - may break existing code that depends on the timing of - side-effects from running reactions. "[:code "flush"]" can be - used to force outstanding reactions to run at a given - time."] + execute immediately whenever the atoms they depended on + changed. This could cause performance issues in code with + expensive reactions and frequent updates to state. However, + this change may break existing code that depends on the + timing of side-effects from running + reactions. "[:code "flush"]" can be used to force outstanding + reactions to run at a given time."] [:li "Reactions now only trigger updates of dependent components and other reactions if they produce a new result,