메모 새로고침 문제 해결: 초기화 시 모든 할일 메모 로드
This commit is contained in:
@@ -102,6 +102,7 @@ function todosApp() {
|
||||
|
||||
await this.loadTodos();
|
||||
await this.loadStats();
|
||||
await this.loadAllTodoMemos();
|
||||
|
||||
// 주기적으로 활성 할일 업데이트 (1분마다)
|
||||
setInterval(() => {
|
||||
@@ -188,6 +189,11 @@ function todosApp() {
|
||||
});
|
||||
|
||||
this.todos.unshift(response);
|
||||
|
||||
// 새 할일의 메모 상태 초기화
|
||||
this.todoMemos[response.id] = [];
|
||||
this.showMemoForTodo[response.id] = false;
|
||||
|
||||
this.newTodoContent = '';
|
||||
await this.loadStats();
|
||||
|
||||
@@ -505,6 +511,33 @@ function todosApp() {
|
||||
});
|
||||
},
|
||||
|
||||
// 모든 할일의 메모 로드 (초기화용)
|
||||
async loadAllTodoMemos() {
|
||||
try {
|
||||
console.log('📋 모든 할일 메모 로드 중...');
|
||||
|
||||
// 모든 할일에 대해 메모 로드
|
||||
const memoPromises = this.todos.map(async (todo) => {
|
||||
try {
|
||||
const response = await window.api.get(`/todos/${todo.id}/comments`);
|
||||
this.todoMemos[todo.id] = response || [];
|
||||
if (this.todoMemos[todo.id].length > 0) {
|
||||
console.log(`✅ ${todo.content.slice(0, 20)}... - ${this.todoMemos[todo.id].length}개 메모 로드`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`❌ ${todo.id} 메모 로드 실패:`, error);
|
||||
this.todoMemos[todo.id] = [];
|
||||
}
|
||||
});
|
||||
|
||||
await Promise.all(memoPromises);
|
||||
console.log('✅ 모든 할일 메모 로드 완료');
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ 전체 메모 로드 실패:', error);
|
||||
}
|
||||
},
|
||||
|
||||
// 할일 메모 로드 (인라인용)
|
||||
async loadTodoMemos(todoId) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user