Skip to content

Commit dfd4739

Browse files
Dan CorasDan Coras
authored andcommitted
fix: created separate effects for each signal, to run non dependent on each other 50-bug-in-effect
1 parent 7472f70 commit dfd4739

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

apps/signal/50-bug-in-effect/src/app/app.component.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,25 @@ export class AppComponent {
4444
Explain for your junior team mate why this bug occurs ...
4545
*/
4646
effect(() => {
47-
console.log('Effect ran');
4847
const drive = this.drive();
48+
49+
if (drive) {
50+
alert('Price increased!');
51+
}
52+
});
53+
54+
effect(() => {
4955
const ram = this.ram();
56+
57+
if (ram) {
58+
alert('Price increased!');
59+
}
60+
});
61+
62+
effect(() => {
5063
const gpu = this.gpu();
5164

52-
if (drive || ram || gpu) {
65+
if (gpu) {
5366
alert('Price increased!');
5467
}
5568
});

0 commit comments

Comments
 (0)