Skip to content

updateOne/updateMany should not change ids state on existing entity #571

@bbaia

Description

@bbaia

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?

updateOne/updateMany updates ids state when updating existing entity.

Expected behavior:

updateOne/updateMany should not change ids state if you attempt to update an entity that has already been added.

Minimal reproduction of the problem with instructions:

Did not run it, but try something like that

  it('should not change ids state if you attempt to update an entity that has already been added', () => {
    const withOne = adapter.addOne(TheGreatGatsby, state);
    const changes = { title: 'A New Hope' };

    const withUpdates = adapter.updateOne(
      {
        id: TheGreatGatsby.id,
        changes,
      },
      withOne
    );

    expect(withOne.ids).toBe(withUpdates.ids);
  });

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

Other information:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions