Skip to content
This repository was archived by the owner on May 1, 2025. It is now read-only.

upsertMany not handling duplicates #796

Open
productivityindustries opened this issue Jan 31, 2022 · 0 comments
Open

upsertMany not handling duplicates #796

productivityindustries opened this issue Jan 31, 2022 · 0 comments

Comments

@productivityindustries
Copy link

Is this a regression?

No

Description

when calling upsertMany on a store with an array of two objects having the same id attribute, two entries are added.

I would expect duplicates not to appear after the operation.

To reproduce, take todo example and in TodoService replace
this.todosStore.add(todo);
with
this.todosStore.upsertMany([todo, todo]);

By analyzing the store there is a single entity, but two ids having the same value:

  todos: {
    entities: {
      zwvlwkpu0fe: {
        id: 'zwvlwkpu0fe',
        title: 'Hello',
        completed: false
      }
    },
    ids: [
      'zwvlwkpu0fe',
      'zwvlwkpu0fe'
    ],
    loading: false,
    error: null,
    ui: {
      filter: 'SHOW_ALL'
    }
  }
}

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/akita-todos-app-yvyiiz?file=src/app/todos/state/todos.service.ts

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in

No response

Anything else?

No response

Do you want to create a pull request?

No

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant