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

fix(store): add Signal equal function for immutable object comparison #3883

Merged
merged 3 commits into from
May 9, 2023

Conversation

mikezks
Copy link
Contributor

@mikezks mikezks commented May 8, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] 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?

All selectors created with store.selectSignal() fire on every global state change, even if the related state received no update.

Closes #3882

What is the new behavior?

If selector(this.state()) returns the same object reference the computed Signal does not trigger a value update anymore.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@netlify
Copy link

netlify bot commented May 8, 2023

Deploy Preview for ngrx-io canceled.

Name Link
🔨 Latest commit 57c2639
🔍 Latest deploy log https://app.netlify.com/sites/ngrx-io/deploys/64595e31f977e70008e18ad1

@mikezks
Copy link
Contributor Author

mikezks commented May 8, 2023

If fix is OK:

  • Review @ngrx/component-store selectSignal() as well.

@markostanimirovic
Copy link
Member

If fix is OK:

  • Review @ngrx/component-store selectSignal() as well.

The same issue happens with ComponentStore.selectSignal. I'll create a PR for that by the end of the day.

@mikezks mikezks changed the title fix(store): add Signal equal function for immutable object comparison (#3882) fix(store): add Signal equal function for immutable object comparison May 8, 2023
Co-authored-by: Marko Stanimirović <[email protected]>
@brandonroberts brandonroberts merged commit 634fdcb into ngrx:master May 9, 2023
@brandonroberts
Copy link
Member

Thanks @mikezks!

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.

selectSignal() fires on every global state change
3 participants