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): add patchState function and remove $update method #4037

Merged

Conversation

markostanimirovic
Copy link
Member

@markostanimirovic markostanimirovic commented Sep 4, 2023

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)
[x] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Signal state is updated by using the $update method:

import { signalState } from '@ngrx/signals';

const usersState = signalState({
  firstName: 'Marko',
  lastName: 'Stanimirovic',
});

usersState.$update({ firstName: 'Brandon' });

What is the new behavior?

Signal state is updated by using the patch function:

import { patchState, signalState } from '@ngrx/signals';

const usersState = signalState({
  firstName: 'Marko',
  lastName: 'Stanimirovic',
});

patchState(usersState, { firstName: 'Brandon' });

Does this PR introduce a breaking change?

[ ] Yes
[x] No

@netlify
Copy link

netlify bot commented Sep 4, 2023

Deploy Preview for ngrx-io canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit ee76f51
🔍 Latest deploy log https://app.netlify.com/sites/ngrx-io/deploys/64f75e4e7bd82e00089266f2

@markostanimirovic markostanimirovic force-pushed the feat/signals/patch-function branch 2 times, most recently from 0162a66 to 11c517d Compare September 4, 2023 23:35
@markostanimirovic markostanimirovic force-pushed the feat/signals/patch-function branch from 11c517d to 0495dbb Compare September 5, 2023 15:45
@markostanimirovic markostanimirovic changed the title feat(signals): add patch function and remove $update method feat(signals): add patchState function and remove $update method Sep 5, 2023
Copy link
Member

@timdeschryver timdeschryver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this!

modules/signals/spec/patch-state.spec.ts Show resolved Hide resolved
Copy link
Member

@brandonroberts brandonroberts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤘🏿

@markostanimirovic markostanimirovic merged commit f2514ba into ngrx:main Sep 7, 2023
5 checks passed
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.

3 participants