From 3841143dd7d99e7b7eeedfe7655156e0b3a96725 Mon Sep 17 00:00:00 2001 From: stephane-vanraes Date: Tue, 20 Jul 2021 13:54:24 +0200 Subject: [PATCH 1/4] Add clarification about reactivity and arrays --- site/content/docs/01-component-format.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/site/content/docs/01-component-format.md b/site/content/docs/01-component-format.md index 0d8cc6a43eb2..4187ce54d343 100644 --- a/site/content/docs/01-component-format.md +++ b/site/content/docs/01-component-format.md @@ -95,7 +95,7 @@ To change component state and trigger a re-render, just assign to a locally decl Update expressions (`count += 1`) and property assignments (`obj.x = y`) have the same effect. -Because Svelte's reactivity is based on assignments, using array methods like `.push()` and `.splice()` won't automatically trigger updates. Options for getting around this can be found in the [tutorial](tutorial/updating-arrays-and-objects). +Because Svelte's reactivity is based on assignments, using array methods like `.push()` and `.splice()` won't automatically trigger updates, to trigger the update a subsequent assignment is requirred. This and more details can also be found in the [tutorial](tutorial/updating-arrays-and-objects). ```sv ``` +```sv + +``` + #### 3. `$:` marks a statement as reactive --- From 55b081f77685c3c8efab7a7ad7591aa6c0dc95ae Mon Sep 17 00:00:00 2001 From: Stephane Date: Tue, 20 Jul 2021 14:01:48 +0200 Subject: [PATCH 2/4] Update site/content/docs/01-component-format.md Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com> --- site/content/docs/01-component-format.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/content/docs/01-component-format.md b/site/content/docs/01-component-format.md index 4187ce54d343..7323b8638b0d 100644 --- a/site/content/docs/01-component-format.md +++ b/site/content/docs/01-component-format.md @@ -95,7 +95,7 @@ To change component state and trigger a re-render, just assign to a locally decl Update expressions (`count += 1`) and property assignments (`obj.x = y`) have the same effect. -Because Svelte's reactivity is based on assignments, using array methods like `.push()` and `.splice()` won't automatically trigger updates, to trigger the update a subsequent assignment is requirred. This and more details can also be found in the [tutorial](tutorial/updating-arrays-and-objects). +Because Svelte's reactivity is based on assignments, using array methods like `.push()` and `.splice()` won't automatically trigger updates. To trigger the update a subsequent assignment is required. This and more details can also be found in the [tutorial](tutorial/updating-arrays-and-objects). ```sv From 7b78fd6f8bd13db82c22ca677f31eeba8a4dd712 Mon Sep 17 00:00:00 2001 From: stephane-vanraes Date: Thu, 22 Jul 2021 07:50:19 +0200 Subject: [PATCH 4/4] update docs on reactivity --- site/content/docs/01-component-format.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/site/content/docs/01-component-format.md b/site/content/docs/01-component-format.md index eafcd8963e25..546715eb56b8 100644 --- a/site/content/docs/01-component-format.md +++ b/site/content/docs/01-component-format.md @@ -95,8 +95,6 @@ To change component state and trigger a re-render, just assign to a locally decl Update expressions (`count += 1`) and property assignments (`obj.x = y`) have the same effect. -Because Svelte's reactivity is based on assignments, using array methods like `.push()` and `.splice()` won't automatically trigger updates. To trigger the update a subsequent assignment is required. This and more details can also be found in the [tutorial](tutorial/updating-arrays-and-objects). - ```sv ``` +--- + +Because Svelte's reactivity is based on assignments, using array methods like `.push()` and `.splice()` won't automatically trigger updates. A subsequent assignment is required to trigger the update. This and more details can also be found in the [tutorial](tutorial/updating-arrays-and-objects). + ```sv