-
Notifications
You must be signed in to change notification settings - Fork 0
Assorted bug fixes #225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assorted bug fixes #225
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,6 +3,7 @@ import { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GetTasks, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GetCompletedTasks, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MarkTaskComplete, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| UncompleteTask, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DeleteTask, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SkipTask, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CreateTask, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -98,6 +99,14 @@ export const skipTask = createAsyncThunk( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const uncompleteTask = createAsyncThunk( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'tasks/uncompleteTask', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async (taskId: number) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const response = await UncompleteTask(taskId) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return response.task | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const deleteTask = createAsyncThunk( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'tasks/deleteTask', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async (taskId: number) => await DeleteTask(taskId), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -229,8 +238,31 @@ const tasksSlice = createSlice({ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const taskId = action.payload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| state.items = state.items.filter(t => t.id !== taskId) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| state.filteredItems = state.filteredItems.filter(t => t.id !== taskId) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Keep completed list consistent when a completed task is deleted. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| state.completedItems = state.completedItems.filter(t => t.id !== taskId) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| deleteTaskFromGroups(taskId, state.groupedItems) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| taskRemovedFromActive: (state, action: PayloadAction<number>) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const taskId = action.payload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| state.items = state.items.filter(t => t.id !== taskId) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| state.filteredItems = state.filteredItems.filter(t => t.id !== taskId) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| deleteTaskFromGroups(taskId, state.groupedItems) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| completedTaskRemoved: (state, action: PayloadAction<number>) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const taskId = action.payload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| state.completedItems = state.completedItems.filter(t => t.id !== taskId) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| completedTaskUpserted: (state, action: PayloadAction<Task>) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const task = action.payload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const index = state.completedItems.findIndex(t => t.id === task.id) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (index >= 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| state.completedItems[index] = task | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| state.completedItems.unshift(task) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| extraReducers: builder => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| builder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -356,10 +388,15 @@ const tasksSlice = createSlice({ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: 'tasks/taskUpserted', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tasksSlice.caseReducers.taskDeleted(state, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| payload: newTask.id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: 'tasks/taskDeleted', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Task is now completed/inactive; remove from active lists and add to completed list. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tasksSlice.caseReducers.taskRemovedFromActive(state, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| payload: newTask.id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: 'tasks/taskRemovedFromActive', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tasksSlice.caseReducers.completedTaskUpserted(state, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| payload: newTask, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: 'tasks/completedTaskUpserted', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+391
to
+399
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Task is now completed/inactive; remove from active lists and add to completed list. | |
| tasksSlice.caseReducers.taskRemovedFromActive(state, { | |
| payload: newTask.id, | |
| type: 'tasks/taskRemovedFromActive', | |
| }) | |
| tasksSlice.caseReducers.completedTaskUpserted(state, { | |
| payload: newTask, | |
| type: 'tasks/completedTaskUpserted', | |
| }) | |
| // Task is now completed/inactive; remove from active lists and add to completed list. | |
| tasksSlice.caseReducers.taskRemovedFromActive(state, { | |
| payload: newTask.id, | |
| type: 'tasks/taskRemovedFromActive', | |
| }) | |
| tasksSlice.caseReducers.completedTaskUpserted(state, { | |
| payload: newTask, | |
| type: 'tasks/completedTaskUpserted', | |
| }) |
Copilot
AI
Dec 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation: The callback functions in these addCase blocks are not indented correctly. They should have an additional 2 spaces of indentation to match the pattern used in other addCase blocks (see lines 451-465 above). The state assignments inside should be indented accordingly.
| state.status = 'loading' | |
| state.error = null | |
| }) | |
| .addCase(uncompleteTask.fulfilled, (state, action) => { | |
| const updatedTask = action.payload | |
| // Task is active again; remove from completed list and upsert into active lists. | |
| tasksSlice.caseReducers.completedTaskRemoved(state, { | |
| payload: updatedTask.id, | |
| type: 'tasks/completedTaskRemoved', | |
| }) | |
| tasksSlice.caseReducers.taskUpserted(state, { | |
| payload: updatedTask, | |
| type: 'tasks/taskUpserted', | |
| }) | |
| state.status = 'succeeded' | |
| state.error = null | |
| }) | |
| .addCase(uncompleteTask.rejected, (state, action) => { | |
| state.status = 'failed' | |
| state.error = action.error.message ?? null | |
| state.status = 'loading' | |
| state.error = null | |
| }) | |
| .addCase(uncompleteTask.fulfilled, (state, action) => { | |
| const updatedTask = action.payload | |
| // Task is active again; remove from completed list and upsert into active lists. | |
| tasksSlice.caseReducers.completedTaskRemoved(state, { | |
| payload: updatedTask.id, | |
| type: 'tasks/completedTaskRemoved', | |
| }) | |
| tasksSlice.caseReducers.taskUpserted(state, { | |
| payload: updatedTask, | |
| type: 'tasks/taskUpserted', | |
| }) | |
| state.status = 'succeeded' | |
| state.error = null | |
| }) | |
| .addCase(uncompleteTask.rejected, (state, action) => { | |
| state.status = 'failed' | |
| state.error = action.error.message ?? null |
Copilot
AI
Dec 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation: These lines use tabs instead of spaces. The rest of the codebase consistently uses spaces (2 spaces per indentation level). Please replace tabs with spaces to maintain consistency.
| store.dispatch(tasksSlice.actions.taskRemovedFromActive(data.id)) | |
| store.dispatch(tasksSlice.actions.completedTaskUpserted(data)) | |
| store.dispatch(tasksSlice.actions.taskRemovedFromActive(data.id)) | |
| store.dispatch(tasksSlice.actions.completedTaskUpserted(data)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation: These lines use tabs instead of spaces. The rest of the codebase consistently uses spaces (2 spaces per indentation level). Please replace tabs with spaces to maintain consistency.