Editing task description to remove it doesn't work (vibe-kanban) (#862)
* Perfect! The fix is implemented and compiles successfully.
**What I fixed:**
- Replaced the simple `.or()` fallback with proper empty string handling
- Empty strings (including whitespace-only) now clear the description field
- Non-empty strings update the description as before
- Omitted fields still preserve existing values
**How it works:**
- `{"description": "new text"}` → updates description to "new text"
- `{"description": ""}` → clears description (sets to NULL)
- `{"description": " "}` → clears description (whitespace trimmed)
- `{}` (field omitted) → keeps existing description unchanged
The fix is simple, backwards-compatible, and handles the exact issue you described without requiring API changes or type modifications.
* Cleanup script changes for task attempt 42e1596a-5b1a-4061-b704-1a30d09f8192
* Perfect! The fix is complete and both frontend and backend checks pass.
**What I fixed:**
- **Frontend**: Changed `description || null` to `description` in all 3 places (edit, create, create-and-start)
- **Backend**: Already handles empty strings as clearing (from previous fix)
**How it works now:**
- When users clear a task description, frontend sends `""` (empty string)
- Backend detects `s.trim().is_empty()` and sets description to `None` (NULL in database)
- Description gets properly cleared after saving
The simple frontend change aligns both systems perfectly. Users can now clear task descriptions by editing them to be empty and saving.
* Cleanup script changes for task attempt 42e1596a-5b1a-4061-b704-1a30d09f8192
This commit is contained in:
committed by
GitHub
parent
f11975ce33
commit
f631c8d6cf
@@ -210,7 +210,11 @@ pub async fn update_task(
|
||||
) -> Result<ResponseJson<ApiResponse<Task>>, ApiError> {
|
||||
// Use existing values if not provided in update
|
||||
let title = payload.title.unwrap_or(existing_task.title);
|
||||
let description = payload.description.or(existing_task.description);
|
||||
let description = match payload.description {
|
||||
Some(s) if s.trim().is_empty() => None, // Empty string = clear description
|
||||
Some(s) => Some(s), // Non-empty string = update description
|
||||
None => existing_task.description, // Field omitted = keep existing
|
||||
};
|
||||
let status = payload.status.unwrap_or(existing_task.status);
|
||||
let parent_task_attempt = payload
|
||||
.parent_task_attempt
|
||||
|
||||
@@ -315,7 +315,7 @@ export const TaskFormDialog = NiceModal.create<TaskFormDialogProps>(
|
||||
taskId: task.id,
|
||||
data: {
|
||||
title,
|
||||
description: description || null,
|
||||
description: description,
|
||||
status,
|
||||
parent_task_attempt: parentTaskAttemptId || null,
|
||||
image_ids: imageIds || null,
|
||||
@@ -332,7 +332,7 @@ export const TaskFormDialog = NiceModal.create<TaskFormDialogProps>(
|
||||
{
|
||||
project_id: projectId,
|
||||
title,
|
||||
description: description || null,
|
||||
description: description,
|
||||
parent_task_attempt: parentTaskAttemptId || null,
|
||||
image_ids: imageIds || null,
|
||||
},
|
||||
@@ -386,7 +386,7 @@ export const TaskFormDialog = NiceModal.create<TaskFormDialogProps>(
|
||||
task: {
|
||||
project_id: projectId,
|
||||
title,
|
||||
description: description || null,
|
||||
description: description,
|
||||
parent_task_attempt: parentTaskAttemptId || null,
|
||||
image_ids: imageIds || null,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user