fix(ui): init editor TCS before dialog can complete
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -54,6 +54,7 @@ public partial class ListEditorViewModel : ViewModelBase
|
|||||||
|
|
||||||
public void InitForCreate()
|
public void InitForCreate()
|
||||||
{
|
{
|
||||||
|
_tcs = new TaskCompletionSource<ListEntity?>();
|
||||||
_editId = null;
|
_editId = null;
|
||||||
_createdAt = DateTime.UtcNow;
|
_createdAt = DateTime.UtcNow;
|
||||||
WindowTitle = "New List";
|
WindowTitle = "New List";
|
||||||
@@ -61,6 +62,7 @@ public partial class ListEditorViewModel : ViewModelBase
|
|||||||
|
|
||||||
public void InitForEdit(ListEntity entity, ListConfigEntity? config)
|
public void InitForEdit(ListEntity entity, ListConfigEntity? config)
|
||||||
{
|
{
|
||||||
|
_tcs = new TaskCompletionSource<ListEntity?>();
|
||||||
_editId = entity.Id;
|
_editId = entity.Id;
|
||||||
_createdAt = entity.CreatedAt;
|
_createdAt = entity.CreatedAt;
|
||||||
Name = entity.Name;
|
Name = entity.Name;
|
||||||
@@ -119,9 +121,5 @@ public partial class ListEditorViewModel : ViewModelBase
|
|||||||
_tcs.TrySetResult(null);
|
_tcs.TrySetResult(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<ListEntity?> ShowAndWaitAsync()
|
public Task<ListEntity?> ShowAndWaitAsync() => _tcs.Task;
|
||||||
{
|
|
||||||
_tcs = new TaskCompletionSource<ListEntity?>();
|
|
||||||
return _tcs.Task;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ public partial class TaskEditorViewModel : ViewModelBase
|
|||||||
|
|
||||||
public void InitForCreate(string listId, string defaultCommitType = "chore")
|
public void InitForCreate(string listId, string defaultCommitType = "chore")
|
||||||
{
|
{
|
||||||
|
_tcs = new TaskCompletionSource<TaskEntity?>();
|
||||||
_editId = null;
|
_editId = null;
|
||||||
_listId = listId;
|
_listId = listId;
|
||||||
_createdAt = DateTime.UtcNow;
|
_createdAt = DateTime.UtcNow;
|
||||||
@@ -81,6 +82,7 @@ public partial class TaskEditorViewModel : ViewModelBase
|
|||||||
|
|
||||||
public async Task InitForEditAsync(TaskEntity entity, IReadOnlyList<TagEntity> taskTags, CancellationToken ct = default)
|
public async Task InitForEditAsync(TaskEntity entity, IReadOnlyList<TagEntity> taskTags, CancellationToken ct = default)
|
||||||
{
|
{
|
||||||
|
_tcs = new TaskCompletionSource<TaskEntity?>();
|
||||||
_editId = entity.Id;
|
_editId = entity.Id;
|
||||||
_listId = entity.ListId;
|
_listId = entity.ListId;
|
||||||
_createdAt = entity.CreatedAt;
|
_createdAt = entity.CreatedAt;
|
||||||
@@ -128,6 +130,7 @@ public partial class TaskEditorViewModel : ViewModelBase
|
|||||||
// Keep old sync overload for callers that haven't loaded agents yet
|
// Keep old sync overload for callers that haven't loaded agents yet
|
||||||
public void InitForEdit(TaskEntity entity, IReadOnlyList<TagEntity> taskTags)
|
public void InitForEdit(TaskEntity entity, IReadOnlyList<TagEntity> taskTags)
|
||||||
{
|
{
|
||||||
|
_tcs = new TaskCompletionSource<TaskEntity?>();
|
||||||
_editId = entity.Id;
|
_editId = entity.Id;
|
||||||
_listId = entity.ListId;
|
_listId = entity.ListId;
|
||||||
_createdAt = entity.CreatedAt;
|
_createdAt = entity.CreatedAt;
|
||||||
@@ -257,9 +260,5 @@ public partial class TaskEditorViewModel : ViewModelBase
|
|||||||
_tcs.TrySetResult(null);
|
_tcs.TrySetResult(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<TaskEntity?> ShowAndWaitAsync()
|
public Task<TaskEntity?> ShowAndWaitAsync() => _tcs.Task;
|
||||||
{
|
|
||||||
_tcs = new TaskCompletionSource<TaskEntity?>();
|
|
||||||
return _tcs.Task;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user