Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jun 18, 2024

Conversation

markostanimirovic
Copy link
Member

@markostanimirovic markostanimirovic commented Jun 15, 2024

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.

Copy link

netlify bot commented Jun 15, 2024

Deploy Preview for ngrx-io ready!

Name Link
🔨 Latest commit 45ad7c6
🔍 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.

@markostanimirovic markostanimirovic changed the title feat(signals): rename signals with computed when defining custom features with input feat(signals): rename signals to computed when defining custom features with input Jun 15, 2024
@markostanimirovic markostanimirovic force-pushed the feat/signals/replace-signals-with-computed branch from ea3adc4 to 45ad7c6 Compare June 18, 2024 20:56
@markostanimirovic markostanimirovic merged commit 05f0940 into main Jun 18, 2024
4 of 5 checks passed
@markostanimirovic markostanimirovic deleted the feat/signals/replace-signals-with-computed branch June 18, 2024 21:16
gisbdzhch pushed a commit to gisktzh/gb3-web_ui that referenced this pull request Aug 13, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@ngrx/schematics](https://github.com/ngrx/platform) | devDependencies | major | [`^17.1.1` -> `^18.0.0`](https://renovatebot.com/diffs/npm/@ngrx%2fschematics/17.2.0/18.0.1) |

---

### Release Notes

<details>
<summary>ngrx/platform (@&#8203;ngrx/schematics)</summary>

### [`v18.0.1`](https://github.com/ngrx/platform/blob/HEAD/CHANGELOG.md#1801-2024-06-27)

[Compare Source](ngrx/platform@18.0.0...18.0.1)

##### Bug Fixes

-   **component-store:** resolve issues in migration script to v18 ([#&#8203;4403](ngrx/platform#4403)) ([a15d53e](ngrx/platform@a15d53e))
-   **effects:** fix bugs in migration script to v18 ([#&#8203;4402](ngrx/platform#4402)) ([6ae4723](ngrx/platform@6ae4723))
-   **eslint-plugin:** only take return statement into account with no-multiple-actions-in-effects ([#&#8203;4410](ngrx/platform#4410)) ([c9c646c](ngrx/platform@c9c646c)), closes [#&#8203;4409](ngrx/platform#4409)

##### Features

-   **signals:** rename signals to computed when defining custom features with input ([#&#8203;4395](ngrx/platform#4395)) ([05f0940](ngrx/platform@05f0940)), closes [#&#8203;4391](ngrx/platform#4391)
-   **signals:** replace `idKey` with `selectId` when defining custom entity ID ([#&#8203;4396](ngrx/platform#4396)) ([67a5a93](ngrx/platform@67a5a93)), closes [#&#8203;4217](ngrx/platform#4217) [#&#8203;4392](ngrx/platform#4392)

### [`v18.0.0`](https://github.com/ngrx/platform/blob/HEAD/CHANGELOG.md#1800-2024-06-13)

[Compare Source](ngrx/platform@17.2.0...18.0.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or rename PR to start with "rebase!".

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename signals to computed when defining custom features with input for consistency
3 participants