From 3d0d8da8b600b76a5aa359cc1c808e5605967d82 Mon Sep 17 00:00:00 2001 From: Alexander CherryTea Date: Fri, 6 Sep 2024 12:38:53 +0200 Subject: [PATCH 1/2] Add note about computed atom behaviour in edge case --- docs/src/content/docs/getting-started/learning.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/src/content/docs/getting-started/learning.md b/docs/src/content/docs/getting-started/learning.md index 554dba34f..90d0cbe72 100644 --- a/docs/src/content/docs/getting-started/learning.md +++ b/docs/src/content/docs/getting-started/learning.md @@ -77,6 +77,8 @@ ctx.get(cAtom) // 3 It's important to note that an atom's value is retrieved only when read. In other words, if no one has read a computed atom, its associated function won't run. +Also, If a computed atom doesn't explicitly track at least one other atom, it will update whenever any atom in the context changes. + ### Update Atom To change the value of an atom, you also need a context. From deda8b0df269e850e3eaf55723a4c9aa962df985 Mon Sep 17 00:00:00 2001 From: Arutiunian Artem Date: Mon, 9 Sep 2024 08:37:25 +0300 Subject: [PATCH 2/2] docs: computed lazines --- docs/src/content/docs/getting-started/learning.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/content/docs/getting-started/learning.md b/docs/src/content/docs/getting-started/learning.md index 90d0cbe72..380b9a890 100644 --- a/docs/src/content/docs/getting-started/learning.md +++ b/docs/src/content/docs/getting-started/learning.md @@ -77,7 +77,7 @@ ctx.get(cAtom) // 3 It's important to note that an atom's value is retrieved only when read. In other words, if no one has read a computed atom, its associated function won't run. -Also, If a computed atom doesn't explicitly track at least one other atom, it will update whenever any atom in the context changes. +Also, If a computed atom doesn't explicitly track at least one other atom (by `spy`), it will recall on each read (`get` / `spy`). ### Update Atom