fix: 하이라이트/메모 API 오류 및 플로팅 메모창 문제 해결

🐛 버그 수정:
- InstrumentedList 오류 해결: highlight.notes 리스트 접근 방식 수정
- this.filterMemos 함수 스코프 오류 해결: this 컨텍스트 안전 처리
- 하이라이트 API에서 메모 관계 로딩 추가 (selectinload)
- 플로팅 메모창 showFloatingMemo 변수 인식 문제 해결

🛠️ 개선사항:
- 안전한 함수 호출: typeof 체크 및 대체 로직 추가
- 하이라이트 응답에 연관된 메모 데이터 포함
- 캐시 버스팅 버전 업데이트 (v2025012227)
- 디버깅 로그 추가로 문제 진단 개선

 결과:
- 하이라이트와 메모가 정상적으로 표시됨
- 플로팅 메모창이 올바르게 작동함
- API 500 오류 해결로 데이터 안전성 확보
This commit is contained in:
Hyungi Ahn
2025-08-25 07:27:24 +09:00
parent c7f55ac50d
commit 5bfa3822ca
3 changed files with 42 additions and 13 deletions

View File

@@ -189,6 +189,7 @@ window.hierarchyApp = function() {
// 하이라이트 및 메모 로드
async loadHighlightsAndNotes(documentId) {
const self = this; // this 컨텍스트 저장
try {
console.log(`📊 하이라이트/메모 로드 시작: ${documentId}`);
@@ -202,16 +203,22 @@ window.hierarchyApp = function() {
const notes = await window.api.getDocumentNotes(documentId);
console.log('📥 메모 API 응답:', notes);
this.highlights = highlights || [];
this.notes = notes || [];
self.highlights = highlights || [];
self.notes = notes || [];
// 메모 사이드바용 필터링된 노트 초기화
this.filterMemos();
if (typeof self.filterMemos === 'function') {
self.filterMemos();
} else {
console.error('❌ filterMemos 함수를 찾을 수 없습니다');
// 수동으로 필터링
self.filteredNotes = self.notes.filter(note => !note.highlight_id);
}
console.log(`📝 최종 저장: 하이라이트 ${this.highlights.length}개, 메모 ${this.notes.length}`);
console.log(`📝 최종 저장: 하이라이트 ${self.highlights.length}개, 메모 ${self.notes.length}`);
if (this.highlights.length > 0) {
console.log('📝 하이라이트 상세:', this.highlights.map(h => ({
if (self.highlights.length > 0) {
console.log('📝 하이라이트 상세:', self.highlights.map(h => ({
id: h.id,
text: h.selected_text,
color: h.color || h.highlight_color