Add news about next-tick and after-update

This commit is contained in:
Dan Holmsand 2015-12-14 15:41:46 +01:00
parent a4198f3703
commit f53b4e4d20
2 changed files with 23 additions and 7 deletions

View File

@ -21,6 +21,10 @@
- `cursor` now shares state between all instances corresponding to a given set of parameters. - `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"}]` - 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. - Reagent now falls back to using `require` if global `React` is undefined, to simplify use with e.g webpack and node.js.

View File

@ -321,6 +321,18 @@
that unnecessary re-renderings were avoided) when passed as that unnecessary re-renderings were avoided) when passed as
arguments to child components."]] 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 [:section.demo-text
[:h2 "Breaking changes"] [:h2 "Breaking changes"]
@ -338,13 +350,13 @@
function, "[:code "reagent.ratom/reaction"]", "[:code "reagent.ratom/run!"]" function, "[:code "reagent.ratom/reaction"]", "[:code "reagent.ratom/run!"]"
and "[:code "reagent.ratom/make-reaction"]" are now lazy and and "[:code "reagent.ratom/make-reaction"]" are now lazy and
executed asynchronously. Previously, reactions used to executed asynchronously. Previously, reactions used to
execute directly whenever the atoms they depended on changed. execute immediately whenever the atoms they depended on
This could cause performance issues in code with expensive changed. This could cause performance issues in code with
reactions and frequent updates to state. However, this change expensive reactions and frequent updates to state. However,
may break existing code that depends on the timing of this change may break existing code that depends on the
side-effects from running reactions. "[:code "flush"]" can be timing of side-effects from running
used to force outstanding reactions to run at a given reactions. "[:code "flush"]" can be used to force outstanding
time."] reactions to run at a given time."]
[:li "Reactions now only trigger updates of dependent [:li "Reactions now only trigger updates of dependent
components and other reactions if they produce a new result, components and other reactions if they produce a new result,