From 83084f9d1c49b715b1b20ec536689685e888a167 Mon Sep 17 00:00:00 2001 From: Antony Jones Date: Tue, 23 Jun 2020 11:11:13 +0100 Subject: [PATCH 1/4] clarify onMount with async --- site/content/docs/03-run-time.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/site/content/docs/03-run-time.md b/site/content/docs/03-run-time.md index 460c393e7e55..75fb03fbe846 100644 --- a/site/content/docs/03-run-time.md +++ b/site/content/docs/03-run-time.md @@ -50,6 +50,8 @@ If a function is returned from `onMount`, it will be called when the component i ``` +Note that returning a function is only available for *synchronous* onMount functions. If an async function or promise is passed to `onMount`, the function returned will **not** be called when the component is unmounted. + #### `beforeUpdate` ```js From 3d3663a9775af78cea2f0bd3a11cced3c1349382 Mon Sep 17 00:00:00 2001 From: Antony Jones Date: Tue, 23 Jun 2020 11:14:33 +0100 Subject: [PATCH 2/4] make more concise --- site/content/docs/03-run-time.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/content/docs/03-run-time.md b/site/content/docs/03-run-time.md index 75fb03fbe846..43d870d94052 100644 --- a/site/content/docs/03-run-time.md +++ b/site/content/docs/03-run-time.md @@ -50,7 +50,7 @@ If a function is returned from `onMount`, it will be called when the component i ``` -Note that returning a function is only available for *synchronous* onMount functions. If an async function or promise is passed to `onMount`, the function returned will **not** be called when the component is unmounted. +> Returning a function is only available for *synchronous* onMount functions. If an `async` function or `Promise` is passed to `onMount`, the returned function will **not** be called. #### `beforeUpdate` From 5b38f7adcba53541549ef5c238a4999812753a9d Mon Sep 17 00:00:00 2001 From: Antony Jones Date: Tue, 23 Jun 2020 15:10:56 +0100 Subject: [PATCH 3/4] modify wording for clarity --- site/content/docs/03-run-time.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/content/docs/03-run-time.md b/site/content/docs/03-run-time.md index 43d870d94052..1c2c0234ecc0 100644 --- a/site/content/docs/03-run-time.md +++ b/site/content/docs/03-run-time.md @@ -50,7 +50,7 @@ If a function is returned from `onMount`, it will be called when the component i ``` -> Returning a function is only available for *synchronous* onMount functions. If an `async` function or `Promise` is passed to `onMount`, the returned function will **not** be called. +> This behaviour will only work when the function passed to `onMount` synchronously returns a value. `async` functions always return a `Promise`, and as such cannot *synchronously* return a function. #### `beforeUpdate` From 2e297efd79a59f383f5f4559ee7980c3b42bc97e Mon Sep 17 00:00:00 2001 From: Antony Jones Date: Tue, 23 Jun 2020 15:13:36 +0100 Subject: [PATCH 4/4] make formatting of synchronously consistent --- site/content/docs/03-run-time.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/content/docs/03-run-time.md b/site/content/docs/03-run-time.md index 1c2c0234ecc0..42a99bea70e6 100644 --- a/site/content/docs/03-run-time.md +++ b/site/content/docs/03-run-time.md @@ -50,7 +50,7 @@ If a function is returned from `onMount`, it will be called when the component i ``` -> This behaviour will only work when the function passed to `onMount` synchronously returns a value. `async` functions always return a `Promise`, and as such cannot *synchronously* return a function. +> This behaviour will only work when the function passed to `onMount` *synchronously* returns a value. `async` functions always return a `Promise`, and as such cannot *synchronously* return a function. #### `beforeUpdate`