From 20bb4f939a433931fea8aecda6044cdb0b49311a Mon Sep 17 00:00:00 2001 From: amirhhashemi <87268103+amirhhashemi@users.noreply.github.com> Date: Sun, 16 Feb 2025 18:15:32 +0330 Subject: [PATCH] Remove inconsistent terms for tracking scope --- src/routes/concepts/stores.mdx | 6 +++--- src/routes/guides/complex-state-management.mdx | 2 +- src/routes/reference/lifecycle/on-cleanup.mdx | 4 ++-- src/routes/reference/reactive-utilities/create-root.mdx | 2 +- src/routes/reference/reactive-utilities/get-owner.mdx | 6 +++--- src/routes/reference/reactive-utilities/untrack.mdx | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/routes/concepts/stores.mdx b/src/routes/concepts/stores.mdx index a151a9ee9..e0932c3bf 100644 --- a/src/routes/concepts/stores.mdx +++ b/src/routes/concepts/stores.mdx @@ -91,9 +91,9 @@ const App = () => { ``` When a store is created, it starts with the initial state but does _not_ immediately set up signals to track changes. -These signals are created **lazily**, meaning they are only formed when accessed within a reactive context. +These signals are created **lazily**, meaning they are only formed when accessed within a tracking scope. -Once data is used within a reactive context, such as within the return statement of a component function, computed property, or an effect, a signal is created and dependencies are established. +Once data is used within a tracking scope, such as within the return statement of a component function, computed property, or an effect, a signal is created and dependencies are established. For example, if you wanted to print out every new user, adding the console log below will not work because it is not within a tracked scope. @@ -402,7 +402,7 @@ Consequently, only `'koala'` - the new edition - will cause an update. ### Extracting raw data with `unwrap` -When there is a need for dealing with data outside of a reactive context, the `unwrap` utility offers a way to transform a store to a standard [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object). +When there is a need for dealing with data outside of a tracking scope, the `unwrap` utility offers a way to transform a store to a standard [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object). This conversion serves several important purposes. Firstly, it provides a snapshot of the current state without the processing overhead associated with reactivity. diff --git a/src/routes/guides/complex-state-management.mdx b/src/routes/guides/complex-state-management.mdx index 9134d1873..d94180da8 100644 --- a/src/routes/guides/complex-state-management.mdx +++ b/src/routes/guides/complex-state-management.mdx @@ -139,7 +139,7 @@ Through `state.numberOfTasks`, the display will now show the store's value held When you want to modify your store, you use the second element returned by the `createStore` function. This element allows you to make modifications to the store, letting you both add new properties and update existing ones. -However, because properties within a store are created lazily, setting a property in the component function body without creating a reactive scope will **not** update the value. +However, because properties within a store are created lazily, setting a property in the component function body without creating a tracking scope will **not** update the value. To create the signal so it reactively updates, you have to access the property within a tracking scope, such as using a [`createEffect`](/reference/basic-reactivity/create-effect): ```jsx diff --git a/src/routes/reference/lifecycle/on-cleanup.mdx b/src/routes/reference/lifecycle/on-cleanup.mdx index 43a464023..1472442f5 100644 --- a/src/routes/reference/lifecycle/on-cleanup.mdx +++ b/src/routes/reference/lifecycle/on-cleanup.mdx @@ -3,11 +3,11 @@ title: onCleanup order: 5 --- -`onCleanup` registers a cleanup method that executes on disposal and recalculation of the current reactive scope. +`onCleanup` registers a cleanup method that executes on disposal and recalculation of the current tracking scope. Can be used anywhere to clean up any side effects left behind by initialization. When used in a Component, it runs when the component is unmounted. -When used in reactive contexts, such [`createEffect`](/reference/basic-reactivity/create-effect), [`createMemo`](/reference/basic-reactivity/create-memo) or a [`createRoot`](/reference/reactive-utilities/create-root), it runs when the reactive scope is disposed or refreshed. +When used in tracking scope, such [`createEffect`](/reference/basic-reactivity/create-effect), [`createMemo`](/reference/basic-reactivity/create-memo) or a [`createRoot`](/reference/reactive-utilities/create-root), it runs when the tracking scope is disposed or refreshed. ```ts import { onCleanup } from "solid-js" diff --git a/src/routes/reference/reactive-utilities/create-root.mdx b/src/routes/reference/reactive-utilities/create-root.mdx index aab8ce89e..588664d27 100644 --- a/src/routes/reference/reactive-utilities/create-root.mdx +++ b/src/routes/reference/reactive-utilities/create-root.mdx @@ -10,7 +10,7 @@ function createRoot(fn: (dispose: () => void) => T): T ``` Creates a new non-tracked owner scope that doesn't auto-dispose. -This is useful for nested reactive scopes that you do not wish to release when the parent re-evaluates. +This is useful for nested tracking scopes that you do not wish to release when the parent re-evaluates. All Solid code should be wrapped in one of these top level as they ensure that all memory/computations are freed up. Normally you do not need to worry about this as createRoot is embedded into all render entry functions. diff --git a/src/routes/reference/reactive-utilities/get-owner.mdx b/src/routes/reference/reactive-utilities/get-owner.mdx index 1be5c3f78..7c1f59504 100644 --- a/src/routes/reference/reactive-utilities/get-owner.mdx +++ b/src/routes/reference/reactive-utilities/get-owner.mdx @@ -10,7 +10,7 @@ function getOwner(): Owner ``` -Gets the reactive scope that owns the currently running code, e.g., for passing into a later call to `runWithOwner` outside of the current scope. +Gets the tracking scope that owns the currently running code, e.g., for passing into a later call to `runWithOwner` outside of the current scope. Internally, computations (effects, memos, etc.) create owners which are children of their owner, all the way up to the root owner created by `createRoot` or `render`. In particular, this ownership tree lets Solid automatically clean up a disposed computation by traversing its subtree and calling all `onCleanup` callbacks. @@ -20,5 +20,5 @@ Calling `getOwner` returns the current owner node that is responsible for dispos Components are not computations, so do not create an owner node, but they are typically rendered from a `createEffect` which does, so the result is similar: when a component gets unmounted, all descendant `onCleanup` callbacks get called. Calling `getOwner` from a component scope returns the owner that is responsible for rendering and unmounting that component. -Note that the owning reactive scope isn't necessarily tracking. -For example, untrack turns off tracking for the duration of a function (without creating a new reactive scope), as do components created via JSX (``). +Note that the owning tracking scope isn't necessarily tracking. +For example, untrack turns off tracking for the duration of a function (without creating a new tracking scope), as do components created via JSX (``). diff --git a/src/routes/reference/reactive-utilities/untrack.mdx b/src/routes/reference/reactive-utilities/untrack.mdx index b73d87b8d..5d3861312 100644 --- a/src/routes/reference/reactive-utilities/untrack.mdx +++ b/src/routes/reference/reactive-utilities/untrack.mdx @@ -2,7 +2,7 @@ title: untrack --- -Ignores tracking any of the dependencies in the executing code block and returns the value. This helper is useful when a certain `prop` will never update and thus it is ok to use it outside of the reactive context. +Ignores tracking any of the dependencies in the executing code block and returns the value. This helper is useful when a certain `prop` will never update and thus it is ok to use it outside of the tracking scope. ```tsx title="component.tsx" import { untrack } from "solid-js" @@ -47,4 +47,4 @@ export function Component(props) { } ``` - \ No newline at end of file +