Skip to content

Commit dbf905f

Browse files
Merge pull request #129 from elliotwaite/small-fixes-to-core
2 parents d3c8cf9 + 7228418 commit dbf905f

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

.changeset/mighty-pianos-end.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@preact/signals-core": patch
3+
---
4+
5+
Fix incorrectly named variables and address typos in code comments.

packages/core/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ export class Signal<T = any> {
111111
// Any leftover dependencies here are not needed anymore
112112
if (shouldCleanup) {
113113
// Unsubscribe from dependencies that were not accessed:
114-
oldDeps.forEach(sub => unsubscribe(this, sub));
114+
oldDeps.forEach(dep => unsubscribe(this, dep));
115115
} else {
116-
// Re-subscribe to dependencies that not accessed:
117-
oldDeps.forEach(sub => subscribe(this, sub));
116+
// Re-subscribe to dependencies that were not accessed:
117+
oldDeps.forEach(dep => subscribe(this, dep));
118118
}
119119

120120
oldDeps.clear();
@@ -198,7 +198,7 @@ const tmpPending: Signal[] = [];
198198
* Refresh _just_ this signal and its dependencies recursively.
199199
* All other signals will be left untouched and added to the
200200
* global queue to flush later. Since we're traversing "upwards",
201-
* we don't have to car about topological sorting.
201+
* we don't have to care about topological sorting.
202202
*/
203203
function refreshStale(signal: Signal) {
204204
pending.delete(signal);

packages/core/test/signal.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ describe("computed()", () => {
361361

362362
// top to bottom
363363
expect(eSpy).to.have.been.calledBefore(fSpy);
364-
// right to left
364+
// left to right
365365
expect(fSpy).to.have.been.calledBefore(gSpy);
366366
});
367367

@@ -650,7 +650,7 @@ describe("batch/transaction", () => {
650650
const spyD = sinon.spy(() => c.value);
651651
const d = computed(spyD);
652652

653-
const spyE = sinon.spy(() => b.value);
653+
const spyE = sinon.spy(() => d.value);
654654
const e = computed(spyE);
655655

656656
spyC.resetHistory();

0 commit comments

Comments
 (0)