From b53b24a059c4dc7c3c22c8110fc8e0ede530642b Mon Sep 17 00:00:00 2001 From: Hicham Guessab Date: Thu, 17 Apr 2025 23:15:23 +0200 Subject: [PATCH] fix: 51 - signal-bug-in-effect --- .../51-function-call-effect/src/app/action.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/signal/51-function-call-effect/src/app/action.component.ts b/apps/signal/51-function-call-effect/src/app/action.component.ts index 22e0e7a4f..c05f6b289 100644 --- a/apps/signal/51-function-call-effect/src/app/action.component.ts +++ b/apps/signal/51-function-call-effect/src/app/action.component.ts @@ -4,6 +4,7 @@ import { effect, inject, signal, + untracked, } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { UserService } from './user.service'; @@ -38,7 +39,8 @@ export class ActionsComponent { constructor() { effect(() => { - this.userService.log(this.action() ?? 'No action selected'); + const action = this.action() ?? 'No action selected'; + untracked(() => this.userService.log(action)); }); } }