Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Pipes in a signal worlds - Template defined computed #61501

@JeanMeche

Description

@JeanMeche

Which @angular/* package(s) are relevant/related to the feature request?

No response

Description

In a signal world, we tend use signal to trigger the framework's reactivity.

Pipes, which date back to Angular.js times, are used to memoise function call (a bit like a computed) but don't fit well with signals today.

Among others here are the key caracteristics of Pipes

  • Can be reused accross components
  • Pipes instance are instantiated during the creation phase of the template
  • Pipes can inject instances from DI
  • Pure pipes are memoized, meaning that they only re-run when at least one of their parameters changes
  • They can can be used without any additional defintion in the component implementation

On the other hand signals, mainly computed :

  • Need to be define in the component
  • Cannot be defined in a template, for example using items of a @for block.
    • We don't have syntax to define one in templates, to be defined only in creation mode
  • The usage of DI rely on the injection at the component level

We can also note (cf #56401) that signals in the transform implementation of pure pipes don't trigger any reactivity.

This is to sum-up that the intersection of Pipes and signal is today incomplete an does address the developer's expectations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues related to the framework runtimecanonicalThis issue represents a canonical design issue in Angular.core: pipescore: reactivityWork related to fine-grained reactivity in the core frameworkcross-cutting: signals

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions