Skip to content

Commit eb92fcf

Browse files
authored
Close over the ref'd element in the useSignalEffect cleanup test (#970)
Reading `ref.current` from the cleanup asserts ref-detach timing the test doesn't mean to assert, and that timing differs between Preact 10 and 11.
1 parent fe12c47 commit eb92fcf

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

packages/preact/test/browser/index.test.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,8 +1210,9 @@ describe("@preact/signals", () => {
12101210
function App() {
12111211
useSignalEffect(() => {
12121212
const value = sig.value;
1213-
spy(value, ref.current);
1214-
return () => cleanup(value, ref.current);
1213+
const el = ref.current;
1214+
spy(value, el);
1215+
return () => cleanup(value, el);
12151216
});
12161217
return <p ref={ref}>{sig.value}</p>;
12171218
}

0 commit comments

Comments
 (0)