ngrx / platform

Reactive State for Angular
https://ngrx.io
Other
7.96k stars 1.95k forks source link

feat(signals): rename signals to computed when defining custom features with input #4395

Closed markostanimirovic closed 2 weeks ago

markostanimirovic commented 3 weeks ago

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

To define computed input, the signals property name is used:

function withN() {
  return signalStoreFeature(
    { signals: type<{ l: Signal<number>; m: Signal<number> }>() },
    withComputed(({ l, m }) => ({
      n: computed(() => l() + m()),
    }))
  );
}

Closes #4391

What is the new behavior?

To define computed input, the computed property name is used:

function withN() {
  return signalStoreFeature(
    { computed: type<{ l: Signal<number>; m: Signal<number> }>() },
    withComputed(({ l, m }) => ({
      n: computed(() => l() + m()),
    }))
  );
}

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

This is not considered as a breaking change because the @ngrx/signals package is in developer preview.

netlify[bot] commented 3 weeks ago

Deploy Preview for ngrx-io ready!

Name Link
Latest commit 45ad7c6f55c4bae9a9a80c59451c3dd0d026dff4
Latest deploy log https://app.netlify.com/sites/ngrx-io/deploys/6671f46f5dffeb0008051be7
Deploy Preview https://deploy-preview-4395--ngrx-io.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.