From c9c98e505ca194abccaad5e338e26e4c60456afc Mon Sep 17 00:00:00 2001 From: Jovi De Croock Date: Fri, 6 Dec 2024 10:03:49 +0100 Subject: [PATCH] Add test for #620 (#623) --- packages/preact/test/index.test.tsx | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/packages/preact/test/index.test.tsx b/packages/preact/test/index.test.tsx index a74ca53b..4e26214f 100644 --- a/packages/preact/test/index.test.tsx +++ b/packages/preact/test/index.test.tsx @@ -251,6 +251,38 @@ describe("@preact/signals", () => { expect(scratch.textContent).to.equal("bar"); }); + it('should not update signals that are "equal"', () => { + const count = signal(0); + const time = computed(() => (count.value < 2 ? count.value : "max")); + let renders = 0; + const Time = () => { + const value = time.value; + renders++; + return

{value}

; + }; + render(