Update kanbn, fix one-change-behind bug with task editor id

This commit is contained in:
Gordon 2021-04-18 20:32:50 +01:00
parent cb8647ba5a
commit ab42299b6b
3 changed files with 143 additions and 649 deletions

781
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -88,7 +88,7 @@
}
},
"dependencies": {
"@basementuniverse/kanbn": "^0.2.4",
"@basementuniverse/kanbn": "^0.3.0",
"dateformat": "^4.5.1",
"formik": "^2.2.6",
"git-user-name": "^2.0.0",

View File

@ -56,7 +56,10 @@ const TaskEditor = ({ task, tasks, columnName, columnNames, dateFormat, panelUui
const handleUpdateName = ({ target: { value }}, values) => {
// Update the id preview
values.id = paramCase(value);
setTaskData({
...taskData,
id: paramCase(value)
});
// Update the webview panel title
vscode.postMessage({
@ -123,7 +126,7 @@ const TaskEditor = ({ task, tasks, columnName, columnNames, dateFormat, panelUui
}
// Check if the id is already in use
if (values.id in tasks && tasks[values.id].uuid !== (task ? task.uuid : '')) {
if (taskData.id in tasks && tasks[taskData.id].uuid !== (task ? task.uuid : '')) {
errors.name = 'There is already a task with the same name or id.';
hasErrors = true;
}
@ -203,7 +206,7 @@ const TaskEditor = ({ task, tasks, columnName, columnNames, dateFormat, panelUui
}}
/>
</label>
<div className="kanbn-task-editor-id">{values.id}</div>
<div className="kanbn-task-editor-id">{taskData.id}</div>
<ErrorMessage
className="kanbn-task-editor-field-errors"
component="div"