From f88da1c6da88f1cb221165b4156ceeae295d688c Mon Sep 17 00:00:00 2001 From: Sage Gerard Date: Fri, 27 Oct 2017 15:25:34 -0400 Subject: [PATCH] Clarify source of 2nd render pass re: preloading data While the docs do say that a second render pass for preloaded data comes from request completion, the example code for preloading data suggests that a promise chain returned from `oninit` has a role to play in controlling the second render pass. The docs should make explicit where the redraw is initiated so the reader does not mistakingly believe that `oninit()` retuning a promise changes anything. --- docs/route.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/route.md b/docs/route.md index 73b0e395..faa5623b 100644 --- a/docs/route.md +++ b/docs/route.md @@ -588,7 +588,7 @@ m.route(document.body, "/secret", { #### Preloading data -Typically, a component can load data upon initialization. Loading data this way renders the component twice (once upon routing, and once after the request completes). +Typically, a component can load data upon initialization. Loading data this way renders the component twice. The first render pass occurs upon routing, and the second fires after the request completes. Take care to note that `loadUsers()` returns a Promise, but any Promise returned by `oninit` is currently ignored. The second render pass comes from the [`background` option for `m.request`](request.md). ```javascript var state = {