You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[ ] Check if updating to the latest version resolves the issue
10
+
11
+
**Environment**
12
+
-[ ] I am using `@preact/signals-core`
13
+
-[ ] I am using `@preact/signals`
14
+
-[ ] I am using `@preact/signals-react`
15
+
-[ ] I understand usage changed in v2, and I've followed the [React Integration instructions](https://github.com/preactjs/signals/tree/main/packages/react#react-integration)
16
+
17
+
**Describe the bug**
18
+
A clear and concise description of what the bug is.
19
+
20
+
**To Reproduce**
21
+
Please provide a link to a StackBlitz/CodeSandbox/Codepen project or a GitHub repository that demonstrates the issue.
22
+
23
+
Steps to reproduce the behavior:
24
+
25
+
1. Go to '...'
26
+
2. Click on '....'
27
+
3. See error
28
+
29
+
**Expected behavior**
30
+
What should have happened when following the steps above?
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+2-6
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,6 @@
2
2
3
3
## Releasing Signals (Maintainers only)
4
4
5
-
This guide is intended for core team members that have the necessary
6
-
rights to publish new releases on npm.
5
+
This guide is intended for core team members that have the necessary rights to merge pull requests to the `main` branch.
7
6
8
-
1. Merge "Version Packages" PR opened by the changesets-action
9
-
2. Switch to the `main` branch and pull the merged PR
10
-
3. Run `pnpm release` to publish packages
11
-
4. Commit updated `pnpm-lock.yaml` if it changed and push it: `git push -f`
7
+
To create a new release, merge "Version Packages" PR opened by the changesets-action. The release workflow will automatically create new releases for the packages that have changesets.
Copy file name to clipboardExpand all lines: README.md
+36-17
Original file line number
Diff line number
Diff line change
@@ -77,23 +77,6 @@ effect(() => {
77
77
78
78
Note that you should only use `signal.peek()` if you really need it. Reading a signal's value via `signal.value` is the preferred way in most scenarios.
79
79
80
-
### `untracked(fn)`
81
-
82
-
In case when you're receiving a callback that can read some signals, but you don't want to subscribe to them, you can use `untracked` to prevent any subscriptions from happening.
83
-
84
-
```js
85
-
constcounter=signal(0);
86
-
consteffectCount=signal(0);
87
-
constfn= () =>effectCount.value+1;
88
-
89
-
effect(() => {
90
-
console.log(counter.value);
91
-
92
-
// Whenever this effect is triggered, run `fn` that gives new value
93
-
effectCount.value=untracked(fn);
94
-
});
95
-
```
96
-
97
80
### `computed(fn)`
98
81
99
82
Data is often derived from other pieces of existing data. The `computed` function lets you combine the values of multiple signals into a new signal that can be reacted to, or even used by additional computeds. When the signals accessed from within a computed callback change, the computed callback is re-executed and its new return value becomes the computed signal's value.
@@ -158,6 +141,25 @@ dispose();
158
141
surname.value="Doe 2";
159
142
```
160
143
144
+
The effect callback may return a cleanup function. The cleanup function gets run once, either when the effect callback is next called _or_ when the effect gets disposed, whichever happens first.
The `batch` function allows you to combine multiple signal writes into one single update that is triggered at the end when the callback completes.
@@ -220,6 +222,23 @@ batch(() => {
220
222
// Now the callback completed and we'll trigger the effect.
221
223
```
222
224
225
+
### `untracked(fn)`
226
+
227
+
In case when you're receiving a callback that can read some signals, but you don't want to subscribe to them, you can use `untracked` to prevent any subscriptions from happening.
228
+
229
+
```js
230
+
constcounter=signal(0);
231
+
consteffectCount=signal(0);
232
+
constfn= () =>effectCount.value+1;
233
+
234
+
effect(() => {
235
+
console.log(counter.value);
236
+
237
+
// Whenever this effect is triggered, run `fn` that gives new value
0 commit comments