We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a36d9d2 commit 3e70d3eCopy full SHA for 3e70d3e
tests/Signal/computed.test.ts
@@ -72,6 +72,28 @@ describe('Computed', () => {
72
});
73
74
75
+ it('should work to change a dependent signal in a computed', () => {
76
+ const s = new Signal.State(0);
77
+ const c = new Signal.Computed(() => {
78
+ const value = s.get();
79
+ if (value < 10) {
80
+ s.set(value + 1);
81
+ }
82
+ return value;
83
+ });
84
+ const d = new Signal.Computed(() => {
85
86
87
88
89
90
91
+ expect(c.get()).toBe(10);
92
+ expect(d.get()).toBe(10);
93
94
95
96
+
97
it('should not recompute when the dependent values go back to the ones used for last computation', () => {
98
const s = new Signal.State(0);
99
let n = 0;
0 commit comments