Entity Id

By default, Akita takes the id key from the entity id field. To change it, you can pass the following argument to the store config.

cart.store.ts
export interface TodosState extends EntityState<CartItem> {}
@StoreConfig({ name: 'todos', idKey: 'todoId' })
export class CartStore extends EntityStore<TodosState, CartItem> {
constructor() {
super();
}
}

The server should always be the single source of truth for the entity's primary id whether it being generated in the client or the server.

ID Type

By default, the id type is any. You can change it by using the second generic parameter:

export interface TodosState extends EntityState<CartItem, string> {}