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

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant