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): Added selectable entities behaviour by default #4718

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DJREMiX6
Copy link

@DJREMiX6 DJREMiX6 commented Mar 8, 2025

  • Updated withEntities to add selectedId and selectedEntity (even for named collections);
  • Created selectEntity helper to select an entity given its ID.
  • Created clearSelectedEntity helper to remove the currently selected entity without caring about its ID.
  • Added Unit Tests
  • Added documentation

Issue reference: #4717

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?

The withEntities() store feature does not allow the user to have a built-in system to select an entity.

Closes #4717

What is the new behavior?

Using withSignals() will expose a selectedId() signal and a selectedEntity() computed signal.
Two helpers can be used to update the selected entity:

  • selectEntity()
  • clearSelectedEntity()

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

- Updated withEntities to add selectedId and selectedEntity (even for named collections);
- Created selectEntity helper to select an entity given its ID.
- Created clearSelectedEntity helper to remove the currently selected entity without caring about its ID.
- Added Unit Tests
- Added documentation

Issue reference: ngrx#4717
Copy link

netlify bot commented Mar 8, 2025

Deploy Preview for ngrx-io ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit aef2533
🔍 Latest deploy log https://app.netlify.com/sites/ngrx-io/deploys/67cc363b5cf46c000771686c
😎 Deploy Preview https://deploy-preview-4718--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.

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.

RFC: Selectable entities behaviour by default
1 participant