Skip to content

fix(entity): preserve falsy IDs when updating entities - #5237

Open
yuxino wants to merge 3 commits into
ngrx:mainfrom
yuxino:fix/entity-falsy-id
Open

yuxino wants to merge 3 commits into
ngrx:mainfrom
yuxino:fix/entity-falsy-id

Conversation

@yuxino

@yuxino yuxino commented Nov 14, 2026

Copy link
Copy Markdown

PR Checklist

  • The commit message follows the repository guidelines.
  • Tests for the change have been added.
  • Documentation has been added or updated.

PR Type

  • Bugfix

What is the current behavior?

Changing an entity's ID to 0 or an empty string updates the entity map but leaves the old ID in the unsorted adapter's ID list. As a result, selectAll returns an undefined entry.

Closes #5236.

What is the new behavior?

Both valid IDs replace the old ID, and selectAll returns the updated entity in its original position. The adapter's existing ID types and usage are unchanged.

Does this PR introduce a breaking change?

No.

Other information

Both regressions reproduced in the published package and were checked against the built candidate. The entity build, tests, and lint passed locally. The last main-branch workflow failed in data:test, with Entity outside the failed targets. The patch was independently reviewed with Codex assistance.

@netlify

netlify Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for ngrx-io ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit d181f3b
🔍 Latest deploy log https://app.netlify.com/projects/ngrx-io/deploys/6b0ed0632475ad5ab96f0e91
😎 Deploy Preview https://deploy-preview-5237--ngrx-io.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@rainerhahnekamp rainerhahnekamp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good catch

This branch has not been deployed

No deployments
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.

@ngrx/entity: unsorted adapter keeps the old id in state.ids when an update changes the id to 0 or ""

3 participants