Skip to content

Commit af4e9b2

Browse files
committed
guide: state is not tied to components, so place it by lifetime
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWLtkg281f1NkGEDjCt
1 parent b78e9ff commit af4e9b2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎guide/async.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ export action rename(id: string, name: string) {
199199

200200
### Data belongs with its lifetime
201201

202-
Declare data where it lives as long as it is needed. A page's list usually belongs to the page: it loads when the page
202+
In .rx, state is not tied to components: a `source` can be declared in a module, a component or a region, and a
203+
component only reads and calls what it is given. So declare data where it lives as long as it is needed. A page's list usually belongs to the page: it loads when the page
203204
opens and goes when it closes. A write in flight lives until the server answers, which can be after its page closed;
204205
the data it refreshes must live at least as long. If it lives in the page, the write's `refresh` re-asks the closed
205206
page's question, and the page opened again keeps the answer it asked for before the write landed, beside views asked

0 commit comments

Comments
 (0)