Skip to content

null value is sometimes added to entity ids by @ngrx/entity #781

@livthomas

Description

@livthomas

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request

What is the current behavior?

When I add entities to the store using adapter.addAll() or adapter.addMany methods, null value is sometimes stored in ids array. If I then try to get entities using some selector, I get a function among those entities. This causes a lot of bugs in my application unless I always filter the returned entities.

Expected behavior:

There should not be any unwanted values inserted into the store.

Minimal reproduction of the problem with instructions:

I have not been able to reproduce this problem by unit tests in this project. However, I can always reproduce it in my application. I have debugged it for a while and discovered that this loop not only goes through entity keys but also iterates over Array prototype method names and as the result null key is pushed to ids array on this line.

Version of affected browser(s),operating system(s), npm, node and ngrx:

Chrome 64, Fedora 27, NPM 5.6.0, Node 8.9.4, NgRx 5.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions