Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mbeckem committed Aug 22, 2024
1 parent 3282b92 commit 78b8e02
Show file tree
Hide file tree
Showing 13 changed files with 1,015 additions and 979 deletions.
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
"prettier:common": "prettier ./packages ./playground --ignore-path .eslintignore --cache"
},
"devDependencies": {
"@types/node": "^18.19.33",
"@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/parser": "^7.9.0",
"@types/node": "^18.19.45",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"concurrently": "^8.2.2",
"esbuild": "^0.21.3",
"esbuild": "^0.23.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"happy-dom": "^14.11.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.7",
"tsx": "^4.10.4",
"typedoc": "^0.25.13",
"typescript": "~5.4.5",
"vite": "^5.2.11",
"vitest": "^1.6.0"
"happy-dom": "^15.0.0",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"tsx": "^4.17.0",
"typedoc": "^0.26.6",
"typescript": "~5.5.4",
"vite": "^5.4.2",
"vitest": "^2.0.5"
},
"engines": {
"node": ">= 20",
Expand Down
4 changes: 4 additions & 0 deletions packages/reactivity-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @conterra/reactivity-core

## v0.5.0

- Update dependencies

## v0.4.0

- Add support for cleanup functions returned from watch callbacks.
Expand Down
20 changes: 10 additions & 10 deletions packages/reactivity-core/async.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,32 @@ describe("effect", () => {
it("re-executes the callback asynchronously", async () => {
const r = reactive(0);
const spy = vi.fn();

effect(() => {
spy(r.value);
});
expect(spy).toHaveBeenCalledTimes(1); // initial setup call
expect(spy.mock.lastCall![0]).toBe(0);

r.value = 1;
expect(spy).toHaveBeenCalledTimes(1); // _not_ called again

await waitForMacroTask();
expect(spy).toHaveBeenCalledTimes(2); // called after delay
expect(spy.mock.lastCall![0]).toBe(1);
});

it("ensures that multiple small changes only trigger one re-execution", async () => {
const r1 = reactive(0);
const r2 = reactive(10);
const spy = vi.fn();

effect(() => {
spy(r1.value, r2.value);
});
expect(spy).toHaveBeenCalledTimes(1); // initial setup call
expect(spy.mock.lastCall).toEqual([0, 10]);

r1.value = 1;
r1.value = 2;
r2.value = 21;
Expand All @@ -44,17 +44,17 @@ describe("effect", () => {
expect(spy).toHaveBeenCalledTimes(2); // called after delay
expect(spy.mock.lastCall).toEqual([2, 22]);
});

it("can be disposed while an execution is already scheduled", async () => {
const r = reactive(0);
const spy = vi.fn();

const handle = effect(() => {
spy(r.value);
});
expect(spy).toHaveBeenCalledTimes(1);
r.value = 2; // triggers execution

handle.destroy();
await waitForMacroTask();
expect(spy).toHaveBeenCalledTimes(1); // not called again
Expand All @@ -78,7 +78,7 @@ describe("watch", () => {
expect(spy).toBeCalledTimes(0);
r1.value = 2; // ignored
handle.destroy();

await waitForMacroTask();
expect(spy).toBeCalledTimes(0);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/reactivity-core/async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class AsyncEffect {
if (this.isDestroyed) {
return;
}

this.effectHandle?.destroy();
this.effectHandle = undefined;
if (this.isExecuting) {
Expand Down
2 changes: 1 addition & 1 deletion packages/reactivity-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"test": "vitest"
},
"dependencies": {
"@preact/signals-core": "^1.6.0"
"@preact/signals-core": "^1.8.0"
},
"devDependencies": {
"project-root": "workspace:*"
Expand Down
2 changes: 1 addition & 1 deletion packages/reactivity-core/struct/struct.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ describe("reactiveStruct", () => {
);
});
it("supports boolean values as computed properties", () => {
// For this test to pass, we had to prevent the return type of
// For this test to pass, we had to prevent the return type of
// the computed property being calculated to true | false.
type MyType = {
boolA: boolean;
Expand Down
7 changes: 3 additions & 4 deletions packages/reactivity-core/struct/struct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,9 @@ type AnyFunc = (...args: any[]) => any;
* @param V The value of the property.
*/
type GetMemberSchemaForProp<T, V> = [V] extends [AnyFunc]
// V is wrapped in an array to prevent distributive conditional types
// see https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
?
| PropertyMemberType
? // V is wrapped in an array to prevent distributive conditional types
// see https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
| PropertyMemberType
| MethodMemberType<T, Parameters<V>, ReturnType<V>>
| ComputedMemberType<T, V>
: PropertyMemberType | ComputedMemberType<T, V>;
Expand Down
2 changes: 1 addition & 1 deletion packages/reactivity-core/sync.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe("syncEffect", () => {
spy(r.value);
});
expect(spy).toBeCalledTimes(1);

r.value = 2;
expect(spy).toBeCalledTimes(2);
});
Expand Down
1 change: 0 additions & 1 deletion packages/reactivity-core/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export function syncEffectOnce(callback: EffectCallback, onInvalidate: () => voi
return handle;
}


/**
* Watches reactive values and executes a callback whenever those values change.
*
Expand Down
Loading

0 comments on commit 78b8e02

Please sign in to comment.