-
Notifications
You must be signed in to change notification settings - Fork 27.1k
toSignal() can not be called inside computed() #50106
Copy link
Copy link
Closed as not planned
Labels
needs: clarificationThis issue needs additional clarification from the reporter before the team can investigate.This issue needs additional clarification from the reporter before the team can investigate.
Description
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
No
Description
toSignal() can not set internal state (state.set() when called from computed(), because of NG0600 ("Writing to signals is not allowed in a computed or an effect by default").
Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/angular-hjphb7?devToolsHeight=33&file=src/main.ts
Please provide the exception or error you saw
ERROR
Error: NG0601: `toSignal()` called with `requireSync` but `Observable` did not emit synchronously.
ERROR
Error: NG0600: Writing to signals is not allowed in a `computed` or an `effect` by default. Use `allowSignalWrites` in the `CreateEffectOptions` to enable this inside effects.
Please provide the environment you discovered this bug in (run ng version)
@angular/core 16.0.0-rc.4
Anything else?
It is reproducible without Component's template, so the issue is not caused by the template: https://stackblitz.com/edit/angular-rbp4uq?devToolsHeight=33&file=src/main.ts
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
needs: clarificationThis issue needs additional clarification from the reporter before the team can investigate.This issue needs additional clarification from the reporter before the team can investigate.