peterkarn / vue-kanban-hierarchical

0 stars 0 forks source link

addTask mutation - id could not be related to the application state #3

Open zpwebbear opened 3 years ago

zpwebbear commented 3 years ago

https://github.com/peterkarnaukhsite/vue-kanban-hierarchical/blob/05dc4f76981778966ee8f1c57c0e496f443411cd/src/store/index.js#L58

Here you create the task and assign the id that relies on the current application state nextTaskId. You could avoid it using some library like uuid or cuid or even write it yourself.

function randomId(){
  return  Math.random().toString(36).substr(2, 9);
}

In this case you can omit the nextTaskId

peterkarn commented 3 years ago

Used uniqid much erlier but forgot to merge this changes. Now id`s is unique.

By the way, can we be sure, that any of this randomizers won`t duplicate id while generating?